コード例 #1
0
ファイル: custon.cs プロジェクト: slacklife1/Apostilas
 static void DisplayCustomAttribute(CustomAttrDemo cattDemo)
 {
   Type type = cattDemo.GetType();
   Object obj = type.GetCustomAttributes(false)[0];
   if(obj is CodeInfoAttribute)
   {
    System.Console.Write("Developer - ");
    System.Console.WriteLine(((CodeInfoAttribute)obj).Devloper);
    System.Console.Write("Reviewer - ");
    System.Console.WriteLine(((CodeInfoAttribute)obj).Reviewer);
    System.Console.Write("Review Date - ");
  System.Console.WriteLine(((CodeInfoAttribute)obj).ReviewDate);
   }
   else
    System.Console.WriteLine("Attribute not found");
 }
コード例 #2
0
ファイル: custon.cs プロジェクト: slacklife1/Apostilas
 static void Main(string[] args)
 {
   CustomAttrDemo cattDemo = new CustomAttrDemo();
   DisplayCustomAttribute(cattDemo);
 }