Csharp/CSharp Tutorial/Attribute/AttributeUsage — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 12:14, 26 мая 2010
AttributeUsage
The AttributeUsage attribute specifies the types of items to which an attribute can be applied.
AttributeUsage is another name for the System.AttributeUsageAttribute class.
AttributeUsage has the following constructor:
AttributeUsage(AttributeTargets item)
Define a attribute for remark
using System;
[AttributeUsage(AttributeTargets.All)]
public class MyAttribute : Attribute {
string remark;
public MyAttribute(string comment) {
remark = comment;
}
public string Remark {
get {
return remark;
}
}
}