예제 #1
0
//      public static void Main()
//      {
//         MyMath mm = new MyMath();
//         Console.WriteLine( "Calling DoFunc(7). Result: {0}",
//            mm.DoFunc1( 7 ) );
//      }
        public static void Main()
        {
            MyMath mm = new MyMath();

            Console.WriteLine("Calling DoFunc(7). Result: {0}",
                              mm.DoFunc1(7));

            // get the member information and use it to
            // retrieve the custom attributes
            System.Reflection.MemberInfo inf = typeof(MyMath);
            object[] attributes;
            attributes =
                inf.GetCustomAttributes(
                    typeof(BugFixAttribute), false);

            // iterate through the attributes, retrieving the
            // properties
            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.Date);
                Console.WriteLine("Comment: {0}", bfa.Comment);
            }
        }
예제 #2
0
        static void Main()
        {
            MyMath mm = new MyMath();

            Console.WriteLine("Calling DoFunc(7). Result: {0}", mm.DoFunc1(7));
        }