快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

编写自定义特性-创新互联

===========================Document.cs

站在用户的角度思考问题,与客户深入沟通,找到谢通门网站设计与谢通门网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都做网站、网站设计、外贸营销网站建设、企业官网、英文网站、手机端网站、网站推广、申请域名虚拟主机、企业邮箱。业务覆盖谢通门地区。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
    [AttributeUsage(AttributeTargets.Property,//该特性能够应用的范围(只能用于属性)
        AllowMultiple = true,//是否支持多个应用到同一个项上
        Inherited = true)//如果特性应用到类或接口上,就会自动应用到所有派生的类或接口上,
        ]              //如果特性应用在属性或方法上,就会自动应用到该方法或属性的重写版本上
    public class DocumentAttribute : Attribute
    {
        private string m_strName;
        private bool m_blnIsYes;
        public bool IsYes { get { return m_blnIsYes; } set { m_blnIsYes = value; } }
        public DocumentAttribute(string p_name)
        {
            this.m_strName = p_name;
        }
    }
}

===========================主程序

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
    class Program
    {
        //指定特性
        [Document("文档一",//构造函数需要传入的值
            IsYes = true)]//可选参数(Document类的属性)
        public string Name { get; set; }
        static void Main(string[] args)
        {
        }
    }
}

创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。


文章标题:编写自定义特性-创新互联
当前地址:http://6mz.cn/article/ggjos.html

其他资讯