C# 自定义特性

 1  [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = false)]
 2     public class LastModifiedAttribute : Attribute
 3     {
 4         private readonly DateTime _dateModified { get; private set; }
 5         private readonly string _changes { get; private set; }
 6         public LastModifiedAttribute(string dateModified, string changes)
 7         {
 8             _dateModified = DateTime.Parse(dateModified);
 9             _changes = changes;
10         }
11         public string Issues { get; set; }
12     }
13 
14     [AttributeUsage(AttributeTargets.Assembly)]
15     public class SupportsWhatsNewAttribute : Attribute
16     { }

 

posted @ 2016-10-21 13:52  指间的徘徊  阅读(626)  评论(0编辑  收藏  举报