using System; using System.Text; using System.Reflection; namespace ConsoleApplication3 { public class mainClass { static void Main(string[] args) { Console.WriteLine(GETMYNAME); Console.Read(); } [CGYClass("CaiGuangyue")] public static string GETMYNAME { get { return "fafa"; } } public string CGYComment; } [AttributeUsage(AttributeTargets.Property,AllowMultiple=false,Inherited=false)] class CGYClassAttribute:Attribute { private string CGYName; public CGYClassAttribute(string cgyName) { this.CGYName = cgyName; Console.WriteLine(this.CGYName); } } }