Пример #1
0
        static void Main(string[] args)
        {
            MethodInfo[] info = typeof(Development).GetMethods(); //reflection
            foreach (var item in info)
            {
                Console.WriteLine("Metod Adı: " + item.Name);
                Console.WriteLine("{");

                DeveloperInfo[] attributes = (DeveloperInfo[])item.GetCustomAttributes(typeof(DeveloperInfo));

                foreach (DeveloperInfo attr in attributes)
                {
                    Console.WriteLine("Geliştirici: " + attr._developers);
                    Console.WriteLine("Release Sürüm: " + attr.Version);
                }

                Console.WriteLine("}");
            }

            ///// Part Two

            AttrExample.Add(new AttrExample {
                Id = 1, Name = "veli"
            });                                                    //we got a warning because we added this function as a obsolete attribute.
            AttrExample.AddNew(new AttrExample {
                Name = "veli"
            });

            Console.Read();
        }
Пример #2
0
 public static void AddNew(AttrExample customer)
 {
     Console.WriteLine(customer.Name + "," + customer.LastName);
 }