⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 developerinfoattribute.cs

📁 csharp-solution,C#高效编程源码
💻 CS
字号:
namespace CustomAttribute
{
    using System;

    /// <summary>
    ///    This class is a custom attribute that allows
    ///    the name of the developer of a class to be stored
    ///    with the metadata of that class.
    /// </summary>
   
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct, AllowMultiple=true)]
    public class DeveloperInfoAttribute: System.Attribute
    {
		private string developerName;
		private string dateCreated;

		// Constructor. Developer Name is the only mandatory parameter for this attribute
        public DeveloperInfoAttribute(string developerName)
        {
            this.developerName = developerName;
        }

		// Property to return the Developer Name
		public string Developer 
		{
			get
			{
				return developerName;
			}
		}

		// Property to get and set the Creation Date 
		// (an optional parameter for this attribute)
		public string Date
		{
			get
			{
				return dateCreated;
			}

			set
			{
				dateCreated = value;
		 	}
		}
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -