2014년 8월 12일 화요일

[예제]C#에서의 Refection 예제[닷넷C#교육/ADO.NET강좌/ASP.NET교육잘하는곳/C#,ASP.NET교육추천/닷넷실무교육/.NET,C#/ADO.NET교육/닷넷학원/ASP.NET실무교육]




using System; 
using System.Reflection; 

class ReflectionTest { 
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); 


foreach(MethodInfo m in mi) { 
Console.WriteLine("Method : {0}", m); 



public static void GetTypeExam() { 
ReflectionTest r = new ReflectionTest(); 
Type t = r.GetType(); 

FieldInfo[] fi = t.GetFields(); 
MethodInfo[] mi = t.GetMethods(); 

foreach(FieldInfo f in fi) { 
Console.WriteLine("Field : {0}", f); 


foreach(MethodInfo m in mi) { 
Console.WriteLine("Method : {0}", m); 



static void Main() { 
TypeofExam(); 
Console.WriteLine("-------------------------"); 
GetTypeExam(); 



[결과] 
Field : Byte MaxValue 
Field : Byte MinValue 
Method : System.String ToString(System.IFormatProvider) 
Method : System.TypeCode GetTypeCode() 
Method : System.String ToString(System.String, System.IFormatProvider) 
Method : Int32 CompareTo(System.Object) 
Method : Int32 GetHashCode() 
Method : Boolean Equals(System.Object) 
Method : System.String ToString() 
Method : Byte Parse(System.String) 
Method : Byte Parse(System.String, System.Globalization.NumberStyles) 
Method : Byte Parse(System.String, System.IFormatProvider) 
Method : Byte Parse(System.String, System.Globalization.NumberStyles, System.IFo 
rmatProvider) 
Method : System.String ToString(System.String) 
Method : System.Type GetType() 
------------------------- 
Method : Int32 GetHashCode() 
Method : Boolean Equals(System.Object) 
Method : System.String ToString() 
Method : Void TypeofExam() 
Method : Void GetTypeExam() 
Method : System.Type GetType()


평일주간[100%환급과정]
(8/18)Spring,MyBatis,Hibernate실무과정
(8/18)자바기초JDBC,Servlet/JSP까지
(8/18)PL/SQL,ORACLE HINT,TUNING
(8/25)C#4.0,WinForm,ADO.NET
(8/25)안드로이드개발자과정
(8/25)SQL기초에서 Schema Object까지
(8/25)오라클자바채용확정교육
평일야간[개인80%환급]
(8/21)Spring, MyBatis, Hibernate
(8/21)HTML5,CSS3,Ajax,jQuery마스터
(8/21)C#,Network,ADO.NET,ASP.NET
(8/26)SQL기초에서실무까지
(8/26)안드로이드개발자과정
(8/28)자바JSP,jQuery,Spring,MyBatis
주말주간[개인80%환급]
(8/16)C#,ASP.NET마스터(8/16)웹퍼블리싱 마스터
(8/16)Spring, MyBatis, Hibernate
(8/16)자바웹&스프링,마이바티스
(8/23)SQL기초에서실무까지
(8/23)자바,네트워크,웹&스프링
(8/30)안드로이드개발자과정
주말야간[개인80%환급]
(8/23)SQL기초에서실무까지
(8/23)자바,네트워크,웹&스프링

댓글 없음:

댓글 쓰기