作者:.NET开发
项目:System.ComponentMode
[DesignOnly(true)]
public CultureInfo GetLanguage {
get {
// Insert code here.
return myCultureInfo;
}
set {
// Insert code here.
}
}
作者:.NET开发
项目:System.ComponentMode
// Gets the attributes for the property.
AttributeCollection attributes =
TypeDescriptor.GetProperties(this)["GetLanguage"].Attributes;
/* Prints whether the property is marked as DesignOnly
* by retrieving the DesignOnlyAttribute from the AttributeCollection. */
DesignOnlyAttribute myAttribute =
(DesignOnlyAttribute)attributes[typeof(DesignOnlyAttribute)];
Console.WriteLine("This property is design only :" +
myAttribute.IsDesignOnly.ToString());