C# 特性(Attribute)
时间:2011-03-26 来源:飘扬
1 [AttributeUsage(AttributeTargets.Class)]///特性应用范围
2 public class IsDbTable:System.Attribute///继承特性基性
3 {
4 public string tablename{get;set;}
5 public IsDbTable(string tableName)
6 {
7 this.tablename = tableName;
8 }
9 private IsDbTable() { }
10 }
11 [AttributeUsage(AttributeTargets.Property)]
12 public class IsNotDbValue : System.Attribute
13 {
14 }
15
16 [AttributeUsage(AttributeTargets.Property)]
17 public class DbFiltering:System.Attribute
18 {
19 public string FilteringRules { get; set; }
20 public DbFiltering(string Filteringrules)
21 {
22 this.FilteringRules = Filteringrules;
23 }
24 }
System.Attribute.GetCustomAttribute(p, typeof(IsNotDbValue))///获取属性特性
相关阅读 更多 +