728x90
728x170
▶ 클래스 계층도 만들기 예제
using System;
using System.Collections.Generic;
...
Type rootType = typeof(Object);
List<Type> descendentTypeList = GetDescendentTypeList(rootType); // '자손 타입 리스트 구하기' 참조
ClassInfo rootClassInfo = new ClassInfo(rootType);
BuildClassHierarchy(rootClassInfo, descendentTypeList);
728x90
▶ 클래스 계층도 만들기
using System;
using System.Collections.Generic;
#region 클래스 계층도 만들기 - BuildClassHierarchy(parentClassInfo, descendentTypeList)
/// <summary>
/// 클래스 계층도 만들기
/// </summary>
/// <param name="parentClassInfo">부모 클래스 정보</param>
/// <param name="descendentTypeList">자손 타입 리스트</param>
public void BuildClassHierarchy(ClassInfo parentClassInfo, List<Type> descendentTypeList)
{
foreach(Type descendentType in descendentTypeList)
{
Type parentType = descendentType.GetTypeInfo().BaseType;
if(parentType == parentClassInfo.Type)
{
ClassInfo classInfo = new ClassInfo(descendentType);
parentClassInfo.ChildClassInfoList.Add(classInfo);
BuildClassHierarchy(classInfo, descendentTypeList);
}
}
}
#endregion
728x90
그리드형(광고전용)
'C# > Common' 카테고리의 다른 글
[C#/COMMON] Thread 클래스 : 스레드 메소드에 인자 전달하기 (0) | 2016.05.05 |
---|---|
[C#/COMMON] Thread 클래스 : 클래스 객체를 사용해 인자 전달하기 (0) | 2016.05.05 |
[C#/COMMON] Process 클래스 : ProcessorAffinity 속성을 사용해 현재 프로세스의 스레드 실행을 예약할 수 있는 프로세서 설정하기 (0) | 2016.05.05 |
[C#/COMMON] SpeechRecognizer 클래스 : 음성 인식 처리하기 (0) | 2016.02.26 |
[C#/COMMON] SpeechRecognitionEngine 클래스 : InstalledRecognizers 정적 메소드를 사용해 설치된 인식기 나열하기 (0) | 2016.02.26 |
[C#/COMMON] 자손 타입 리스트 구하기 (0) | 2016.02.06 |
[C#/COMMON] Console 클래스 : ForegroundColor 정적 속성을 사용해 문자열 출력시 색상 설정하기 (0) | 2016.01.28 |
[C#/COMMON] Publish 클래스 : GacInstall 메소드를 사용해 어셈블리 GAC 등록하기 (0) | 2016.01.27 |
[C#/COMMON] SpeechSynthesizer 클래스 : 음성 출력하기 (0) | 2016.01.27 |
[C#/COMMON] 닷넷 어셈블리 2.0 버전을 닷넷 4.5 프로젝트에서 사용하기 (0) | 2016.01.25 |