Пример #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            var sampleobj = Activator.CreateInstance("ReflectionSample",
                                                     "ReflectionSample.SampleClass").Unwrap();

            var methodreturn = sampleobj.GetType()?.GetMethod("GetProperty1")?.Invoke(sampleobj, null);

            sampleobj.GetType()?.GetProperty("property1")?.SetValue(sampleobj, "deneme");
            methodreturn = sampleobj.GetType()?.GetMethod("GetProperty1")?.Invoke(sampleobj, null);
            var refas = Assembly.Load("ReflectionSample").GetType("ReflectionSample.SampleClass");

            string location = typeof(EnumSample).Assembly.Location;
            var    obj      = Activator.CreateInstance("csharpbasicsstandart",
                                                       "csharpbasics.AttributeSample");

            var        properties = obj.GetType().GetProperties();
            EnumSample enumsamp   = new EnumSample();

            enumsamp.OdayaGirebilir(AuthTree.Mudur);
            enumsamp.OdayaGirebilir(AuthTree.Ogrenci);
            AuthTree ogretmenVeli = (AuthTree.Veli | AuthTree.Ogretmen);

            enumsamp.OdayaGirebilir(ogretmenVeli);
            enumsamp.OdayaGirebilir(AuthTree.Ogretmen);
            enumsamp.OdayaGirebilir(AuthTree.MudurYard);
            enumsamp.OdayaGirebilir(AuthTree.Veli | AuthTree.Ogrenci);
            enumsamp.OdayaGirebilir(AuthTree.Mudur | AuthTree.Ogretmen);
            MessageBox.Show(enumsamp.girebilenler.ToString());
            int number  = 10;
            int number2 = number++;

            Console.WriteLine((number2));
            Console.WriteLine((number));
            Console.WriteLine((++number));
            Console.WriteLine((number));

            PartialSample1 prt = new PartialSample1();

            csharpbasics.A a1 = new A(5, 6);
            csharpbasics.A a2 = new A(5, 6);
            a1 += a2;
            csharpbasics.A a3 = a1 + a2;
            BoxingUnboxing.BoxandUnboxSample();
        }
Пример #2
0
        static void Main(string[] args)
        {
            bool key = true;

            while (key)
            {
                Console.WriteLine(" 1: OOPLibrary \n 2: ShowIEnumerableIEnumeratorLibrary" +
                                  "\n 3: IComparableLibrary \n 4:BoxingUnboxingLibrary \n 5:IQueryableLibrary");

                switch (Console.ReadLine())
                {
                case "1":
                    OOPResult.ShowOOP();
                    break;

                case "2":
                    IEnumeratorResult.ShowIEnumerableIEnumerator();
                    break;

                case "3":
                    IComparableResult.ShowIComporable();
                    break;

                default:
                    key = false;
                    break;

                case "4":
                    BoxingUnboxing.ShowBoxingUnboxing();
                    break;

                case "5":
                    IQueryableProgram.IQueryableRun();
                    break;
                }
            }
        }