Esempio n. 1
0
        static void Main(string[] args)
        {
            /*
             *  MyGent<string> str = new MyGent<string> { };
             *  MyGent<object> obj = new MyGent<object> { };
             *  //can i say str == obj
             *  str = obj;
             *  //can i say obj == str
             *  obj = str;
             */
            //create an object of the interface
            //Note, get all common info MyI -> MyC
            MyI <string> str = new MyC <string> {
            };
            MyI <object> obj = new MyC <object> {
            };

            str = obj;              //in keyword, makes your store object in string
            //note now both str and obj are now objects ---- <in t>
            Console.WriteLine(str); //InAndOutInGenericModifiers.MyC`1[System.Object]
            Console.WriteLine(obj); //InAndOutInGenericModifiers.MyC`1[System.Object]
            //get to use out instead of in  --- <out type>
            MyO <string> str_out = new MyOc <string> {
            };
            MyO <object> obj_out = new MyOc <object> {
            };

            obj_out = str_out;          //out keyword, makes your store string in object
            Console.WriteLine(str_out); //InAndOutInGenericModifiers.MyOc`1[System.String]
            Console.WriteLine(obj_out); //InAndOutInGenericModifiers.MyOc`1[System.String]
            Console.ReadKey();
        }
Esempio n. 2
0
            public static void main()
            {
                var a = new MyC();

                a.MyV = "main";
                test(a);
                Console.Write(a.MyV); // Что выведется в консоль в этом месте?
            }
Esempio n. 3
0
        private void Main01()
        {
            MyA mB = new MyB(1, 2, 3, 4);
            MyA mC = new MyC(1, 2, 3);

            Console.WriteLine("mB: ({0})", mB.ToString());
            Console.WriteLine("mB: ({0})", mB);
            Console.WriteLine("mC: ({0})", mC);
        }
Esempio n. 4
0
        private void Main03()
        {
            MyA mB = new MyB(1, 2, 3, 4);
            MyA mC = new MyC(11, 12, 13);
            MyA mX;

            for (int i = 0; i < 10; ++i)
            {
                if (MyUtility.myFate.Next(0, 2) == 0)
                {
                    mX = mB.Copy();
                }
                else
                {
                    mX = mC.Copy();
                }
                Console.WriteLine("mX: ({0})", mX);
            }
        }
Esempio n. 5
0
    private ReorderableList DrawList(SerializedProperty sp)
    {
        MyC cc = new MyC();

        cc.sp    = sp;
        cc.maker = this;
        ReorderableList reorderableList;

        if (this.dictA.TryGetValue(cc.sp.propertyPath, out reorderableList))
        {
            return(reorderableList);
        }
        reorderableList = new ReorderableList(cc.sp.serializedObject, cc.sp);
        reorderableList.drawHeaderCallback  = new ReorderableList.HeaderCallbackDelegate(this.DrawRect);
        reorderableList.elementHeight       = EditorGUIUtility.singleLineHeight;
        reorderableList.drawElementCallback = new ReorderableList.ElementCallbackDelegate(cc.RR);
        this.dictA.Add(cc.sp.propertyPath, reorderableList);
        return(reorderableList);
    }
Esempio n. 6
0
 public static void test(MyC a)
 {
     a     = new MyC();
     a.MyV = "test";
 }