System.Type 類
獲取Type引用的3種方法
1.Type t = typeof(double);
2.double d =10.2;Type t = d.GetType();
3.Type t = Type.GetType(string type); //Type.GetType("System.Double");
System.Attribute 類
[AttributeUsage(AttributeTargets.Property,AllowMultiple=true,Inherited=false)]
public class FieldNameAttribute:Attribute
{
private string name;
public FieldNameAttribute(string name)
{
this.name = name;
}
}
System.Reflection.Assembly 類
它允許訪問給定程序集的元素據。 使用Assembly.Load()和Assembly.LoadFrom()加載程序集。
Assembly.Load("SomeAssemby");
查找定製特性. 調用Attribute.GetCustomAttribute();
所有的特性都是作爲一般的Attribute引用來獲取,若要調用爲定製特性定義的任何方法或屬性,需要顯示轉換爲相關的定製特性類。