日期:2014-05-17 浏览次数:20917 次
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
[ComVisible(false)]
public sealed class ORMContractAttribute:Attribute{
public string TableName;
public ORMContractAttribute(String TableName){this.TableName = TableName
;
}
}
{
[ORMContract("TableName")]
public class alibum{}
alibum A = new alibum();
object[] attributes = typeof(alibum).GetCustomAttributes(true);
foreach (object attr in attributes)
{
ORMContractAttribute myAttribute = attr as ORMContractAttribute;
if (myAttribute!=null)
Console.WriteLine(myAttribute.TableName);
}