csharp System.ComponentModel.RecommendedAsConfigurableAttribute类(方法)实例源码

下面列出了csharp System.ComponentModel.RecommendedAsConfigurableAttribute 类(方法)源码代码实例,从而了解它的用法。

作者:.NET开发    项目:System.ComponentMode   
[RecommendedAsConfigurable(true)]
 public int MyProperty {
    get {
       // Insert code here.
       return 0;
    }
    set {
       // Insert code here.
    }
 }

作者:.NET开发    项目:System.ComponentMode   
// Gets the attributes for the property.
AttributeCollection attributes = 
   TypeDescriptor.GetProperties(this)["MyProperty"].Attributes;
 
// Checks to see if the value of the RecommendedAsConfigurableAttribute is Yes.
if(attributes[typeof(RecommendedAsConfigurableAttribute)].Equals(RecommendedAsConfigurableAttribute.Yes)) {
   // Insert code here.
}
 
// This is another way to see if the property is recommended as configurable.
RecommendedAsConfigurableAttribute myAttribute = 
   (RecommendedAsConfigurableAttribute)attributes[typeof(RecommendedAsConfigurableAttribute)];
if(myAttribute.RecommendedAsConfigurable) {
   // Insert code here.
}

作者:.NET开发    项目:System.ComponentMode   
AttributeCollection attributes = 
   TypeDescriptor.GetAttributes(MyProperty);
if(attributes[typeof(RecommendedAsConfigurableAttribute)].Equals(RecommendedAsConfigurableAttribute.Yes)) {
   // Insert code here.
}


问题


面经


文章

微信
公众号

扫码关注公众号