목차
Reflection
System.Type class
System.Reflection namespace
어셈블리 로딩
어셈블리 정보 접근
System.Type class
System.Reflection namespace
어셈블리 로딩
어셈블리 정보 접근
본문내용
응용 프로그램이나 다른 어셈블리에 있는 data type에 관한 정보를 찾아내고,
어셈블리 매니페스트로부터 다른 메타데이터를 읽어들이기 위한 방법
System.Reflection namespace에는 많은 class 들이 리플렉션 서비스를 위해 제공됨
리플렉션을 사용하기 위해서는 data type에 대한 정보를 제공하는 System.Type class 활용해야 한다.
해당 data type에 대한 다양한 정보를 얻을 수 있는 기능 제공
추상 클래스(abstract class)이기때문에 new 연산자를 통해 reference를 얻을 수 없다.
Type 참조 방법
typeof 연산자를 사용string property
Name
FullName
Namespace
reference property
BaseType
boolean property
IsAbstract, IsArray, IsClass, IsInterface, IsPrimitive, IsPublic, IsSealed, ,IsValueType 등
항목 정보 배열 얻기
GetConstructors(), GetEvents(), GetFields(), GetInterfaces(), GetMethods(), GetMembers(), GetnestedTypes() 등
GetType() 를 사용
Type class의 static method인 GetType() 를 사용
Type t = typeof(int); // 파라메터는 data type
int i = 123;
Type t = i.GetType(); // 모든 class는 System.object에서 상속받는다.
Type t = Type.GetType(“System.Int32”)
어셈블리 매니페스트로부터 다른 메타데이터를 읽어들이기 위한 방법
System.Reflection namespace에는 많은 class 들이 리플렉션 서비스를 위해 제공됨
리플렉션을 사용하기 위해서는 data type에 대한 정보를 제공하는 System.Type class 활용해야 한다.
해당 data type에 대한 다양한 정보를 얻을 수 있는 기능 제공
추상 클래스(abstract class)이기때문에 new 연산자를 통해 reference를 얻을 수 없다.
Type 참조 방법
typeof 연산자를 사용string property
Name
FullName
Namespace
reference property
BaseType
boolean property
IsAbstract, IsArray, IsClass, IsInterface, IsPrimitive, IsPublic, IsSealed, ,IsValueType 등
항목 정보 배열 얻기
GetConstructors(), GetEvents(), GetFields(), GetInterfaces(), GetMethods(), GetMembers(), GetnestedTypes() 등
GetType() 를 사용
Type class의 static method인 GetType() 를 사용
Type t = typeof(int); // 파라메터는 data type
int i = 123;
Type t = i.GetType(); // 모든 class는 System.object에서 상속받는다.
Type t = Type.GetType(“System.Int32”)
추천자료
c로배우는알고리즘에서 ROBOT프로그램을 C언어로 바꾸자.
C언어 야구 게임
C언어를 이용해 하노이탑 구현 프로그램
C언어를 이용한 분수의 덧셈과 곱셈을 하는 프로그램
C언어를 이용해 문자열을 추출하는 프로그램
C언어를 이용한 야구게임(숫자맞추기) 프로그램
C언어를 이용한 성적처리(성적관리) 프로그램
C언어를 이용한 [3][3]행렬(3*3행렬), 행렬의 덧셈과 행렬의 곱셈
C언어 처음공부하는 사람들에게 도움이 되는 코딩들(기초부터 포인터까지)
c언어로 만든 typedef 구조체 개념 프로그램
c언어 계산기
c언어로 애니메이션을 만들어 주세요
c언어에서의 포인터(pointer)
C언어로 제작한 푸쉬푸쉬 게임