zoukankan      html  css  js  c++  java
  • 一个特性的例子

    代码
    [global::System.AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
    sealed class MyControlAttribute : Attribute
    {
        
    // See the attribute guidelines at 
        
    //  http://go.microsoft.com/fwlink/?LinkId=85236
        readonly string positionalString;

        
    // This is a positional argument
        public MyControlAttribute(string positionalString)
        {
            
    this.positionalString = positionalString;

            
    // TODO: Implement code here
            throw new NotImplementedException();
        }

        
    public string PositionalString
        {
            
    get { return positionalString; }
        }

        
    // This is a named argument
        public int NamedInt { getset; }


        
    public ControlTypes ControlName
        { 
    getset; }


        
    public MyControlAttribute()
        {
            
        }
    }

    public class MyClass
    {
        [MyControl(ControlName 
    = ControlTypes.TextBox)]
        
    public string MyProperty
        { 
    getset; }
    }


    public enum ControlTypes
    {
        TextBox,
        DropDownList,
        Label,
    }
  • 相关阅读:
    多线程(一) NSThread
    Swift 烧脑体操(一)
    Swift 烧脑体操(二)
    UINavigationController使用的注意事项
    更多请查看我的文章
    本地通知
    网络编程(二)NSURLSessionConfiguration
    A
    51Nod 1116 K进制下的大数(暴力枚举)
    51Nod 1065 最小正子段和
  • 原文地址:https://www.cnblogs.com/wantingqiang/p/1726959.html
Copyright © 2011-2022 走看看