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,
    }
  • 相关阅读:
    mysql数据库常用命令
    二维码的生成--后台版
    软件构建--目录
    软件构建--项目总结
    软件构建--产品测试
    软件构建--产品研发
    软件构建--系统设计
    百度分享代码
    JS定时跳转URL并输出剩余秒数
    c#生成word文档
  • 原文地址:https://www.cnblogs.com/wantingqiang/p/1726959.html
Copyright © 2011-2022 走看看