摘要
在網上查找了不少的資料
usingSystem;
namespaceWebtest
…{
publicinterfaceinterface
…{
intadd()
}
publicclassReflectTest:interface
…{
publicStringWrite;
privateStringWritec;
publicStringWritea
…{
get
…{
returnWrite;
}
set
…{
Write=value;
}
}
privateStringWriteb
…{
get
…{
returnWritec;
}
set
…{
Writec=value;
}
}
publicReflectTest()
…{
this
this
}
publicReflectTest(stringstr
…{
this
this
}
publicstringWriteString(strings
…{
return
}
publicstaticstringWriteName(strings)
…{
return
}
publicstringWriteNoPara()
…{
return
}
privatestringWritePrivate()
…{
return
}
publicintadd()
…{
return
}
}
}
然後
usingSystem;
usingSystem
usingSystem
classTest
…{
delegatestringTestDelegate(stringvalue
staticvoidMain()
…{
//AssemblyAssemblyt=Assembly
AssemblyAssemblyt=Assembly
foreach(Typeaaaint
…{
//Console
}
Module[]modules=t
foreach(Modulemoduleinmodules)
…{
//Console
}
Typea=typeof(Webtest
//Typea=t
//Console
string[]bb=…{
objectobj=Activator
//objectobj=t
MethodInfo[]miArr=a
foreach(MethodInfomi
…{
//Console
}
MethodInfomi=a
object[]aa=…{
strings=(string)mi
MethodInfomi
String[]aa
strings
MethodInfomi
strings
MethodInfomi
strings
//Console
PropertyInfo[]piArr=a
(BindingFlags
foreach(PropertyInfopiinpiArr)
…{
//Console
}
PropertyInfopi
//pi
//Console
PropertyInfopi
(
pi
//Console
FieldInfofi
//Console
ConstructorInfo[]ci
foreach(ConstructorInfociinci
…{
//Console
}
ConstructorInfoasCI=a
typeof(string)
//Console
Webtest
(
Webtest
//Console
foreach(Typettint
…{
if(tt
…{
Webtest
//Console
}
}
TestDelegatemethod=(TestDelegate)Delegate
(typeof(TestDelegate)
//動態創建委托的簡單例子
Console
Console
}
}
在這裡我把我們常用的方法
From:http://tw.wingwit.com/Article/program/net/201311/11178.html