使用反射.
System.Type;
System.TypeReference;
public static void Main()
{
MyMath mm=new MyMath();
Console.WriteLine("Calling DoFunc(7).Result:{0}",mm.DoFunc1(7));
System.Reflection.MemberInfo inf=typeof(MyMath);
object[] attributes;
attributes=int.GetCustomAttributes(typeof(BugFixAttribute),false);foreach(Object attribute in attributes)
{
BugFixAttribute bfa=(BugFixAttribute)attribute;
Console.WriteLine("\nBugID:{0}",bfa.BugID);
Console.WriteLine("Programmer:{0}",bfa.Programmer);
Console.WriteLine ("Date{0}",bfa.Data);
Console.WriteLine ("Comment:{0}",bfa.Comment);
}}
System.Type;
System.TypeReference;
public static void Main()
{
MyMath mm=new MyMath();
Console.WriteLine("Calling DoFunc(7).Result:{0}",mm.DoFunc1(7));
System.Reflection.MemberInfo inf=typeof(MyMath);
object[] attributes;
attributes=int.GetCustomAttributes(typeof(BugFixAttribute),false);foreach(Object attribute in attributes)
{
BugFixAttribute bfa=(BugFixAttribute)attribute;
Console.WriteLine("\nBugID:{0}",bfa.BugID);
Console.WriteLine("Programmer:{0}",bfa.Programmer);
Console.WriteLine ("Date{0}",bfa.Data);
Console.WriteLine ("Comment:{0}",bfa.Comment);
}}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货