닷넷,c# 리플렉션 클래스(Reflection Class는 객체에 대한 타입(Type) 정보를 알 수 있게 해 준다.)
using System;
using System.Reflection;
class ReflectionTest {
public static void TypeofExam() {
Type t = typeof(byte);
FieldInfo[] fi = t.GetFields();
MethodInfo[] mi = t.GetMethods();
public static void TypeofExam() {
Type t = typeof(byte);
FieldInfo[] fi = t.GetFields();
MethodInfo[] mi = t.GetMethods();
foreach(FieldInfo f in fi) {
Console.WriteLine("Field : {0}", f);
}
Console.WriteLine("Field : {0}", f);
}
foreach(MethodInfo m in mi) {
Console.WriteLine("Method : {0}", m);
}
}
Console.WriteLine("Method : {0}", m);
}
}
public static void GetTypeExam() {
ReflectionTest r = new ReflectionTest();
Type t = r.GetType();
ReflectionTest r = new ReflectionTest();
Type t = r.GetType();
FieldInfo[] fi = t.GetFields();
MethodInfo[] mi = t.GetMethods();
MethodInfo[] mi = t.GetMethods();
foreach(FieldInfo f in fi) {
Console.WriteLine("Field : {0}", f);
}
Console.WriteLine("Field : {0}", f);
}
foreach(MethodInfo m in mi) {
Console.WriteLine("Method : {0}", m);
}
}
Console.WriteLine("Method : {0}", m);
}
}
static void Main()
{
TypeofExam();
Console.WriteLine("-------------------------");
GetTypeExam();
}
}
TypeofExam();
Console.WriteLine("-------------------------");
GetTypeExam();
}
}
오라클자바커뮤니티
추천 실전 강좌 - 개인80%환급
댓글 없음:
댓글 쓰기