Example #1
0
        public void TestMethod1()
        {
            dynamic demo = new Demo();
            demo.VoerIetsUit();

            Demo2 demo2 = new Demo2();
            demo2.Invoke("VoerIetsUit");
        }
Example #2
0
        public override void Init()
        {
            List <IDemo> list = new List <IDemo>(0);

            var go = new UnityEngine.GameObject("demo1");

            go.transform.SetParent(UnityEngine.GameObject.Find("ConvertDemo").transform);

            Demo1 d1 = go.CreateJBehaviour <Demo1>();
            Demo2 d2 = new Demo2();

            list.Add(d1);
            list.Add(d2);


            Log.Print($"[ConvertDemo] list 有{list.Count}个元素");
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Demo1 d = new Demo1();
            //d.Run();
            Demo2 d2 = new Demo2();

            d2.Run();

            EventPublisher p = new EventPublisher();

            EventSubscriber1 s1 = new EventSubscriber1();
            EventSubscriber2 s2 = new EventSubscriber2();


            p.Added += s1.AddedEventHandler;
            p.Added += s2.AddedEventHandler;

            p.Add(50);
        }
Example #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("// Beispiel: ..\\Kapitel 3\\Wertuebergabe");
            Console.WriteLine("");

            // casual call by value
            DoSomething(value);
            DoSomething(refString);
            Console.WriteLine($"call by value = {value}");
            Console.WriteLine($"call by value = {refString}");

            // call by reference Operation
            DoSomething(ref value);
            DoSomething(ref refString);
            Console.WriteLine($"call by reference = {value}");
            Console.WriteLine($"call by reference = {refString}");

            DoSomethingO(out value);
            DoSomethingO(out refString);
            Console.WriteLine($"called \"out\" = {value}");
            Console.WriteLine($"called \"out\" = {refString}");

            Console.WriteLine("");
            Console.WriteLine("// Beispiel: ..\\Kapitel 3\\UebergabeEinerReferenz");
            Console.WriteLine("");

            Demo1 object1 = new Demo1();
            Demo2 object2 = new Demo2();

            object2.ChangeValue(object1);

            Console.WriteLine("object2.ChangeValue( object1) call:");

            Console.Write(object1.Value);
            Console.WriteLine(" = object1.Value");
            Console.WriteLine(object1);

            Console.WriteLine("");
            Console.WriteLine("TEST no .value for object");
            Console.WriteLine("");

            //Console.WriteLine("object2");
            Console.WriteLine(object2);
            Console.WriteLine("");

            Console.WriteLine("object2.ChangeValue(ref object1) call:");
            object2.ChangeValue(ref object1);
            Console.Write(object1.Value);
            Console.WriteLine(" = object1.Value");

            Console.WriteLine("");
            Console.WriteLine("Assigning an object to a parameter means that the " +
                              "reference to the object\nis passed as an argument, " +
                              "not just any value.");
            Console.WriteLine("");

            Console.WriteLine("TEST no~2a new obj3&4 as above, call of object4.ChangeValue(object3)");
            Demo1 object3 = new Demo1();
            Demo2 object4 = new Demo2();

            object4.ChangeValue(object3);
            Console.WriteLine(object3.Value);
            Console.WriteLine("= object3.Value");
            Console.WriteLine("");

            Console.WriteLine("TEST no~2b same objects agian call of object4.ChangeValue(ref object3) agian!");
            object4.ChangeValue(ref object3);
            Console.WriteLine(object1.Value);

            Console.WriteLine("= object.1.Value");

            // When objects like (object1 & object3) are created from Class Demo1 they "inherit"? the Value = 500.
            // The objects (object2 & object4)are created from Class Demo2 they will get assigned the Value of the Demo2
            // class [by calling the ChangeValue Method with (ref Demo1 @object) they receive the object Value of 4711...]

            Console.ReadLine();
        }
Example #5
0
        static void Main(string[] args)
        {
            Demo2 d = new Demo2();

            d.Show();
        }
Example #6
0
 private void Demo2_Click(object sender, RoutedEventArgs e)
 {
     Demo2.Show();
 }
Example #7
0
 public void ToStructure2()
 {
     m_Demo2 = m_Data.ToStructure <Demo2>();
 }
Example #8
0
 static void Main(string[] args)
 {
     Demo1.Run();
     Demo2.Run();
     Demo3.Run();
 }