Exemplo n.º 1
0
        static void Main(string[] args)
        {
            StructArray <int> a = new StructArray <int>(3);

            a.Array[0] = 0;
            a.Array[1] = 1;
            a.Array[2] = 2;

            RefArray <StructArray <double> > b = new RefArray <StructArray <double> >(3);

            b.Array[0] = new StructArray <double>(5);
            b.Array[1] = new StructArray <double>(10);
            b.Array[2] = new StructArray <double>(1005);

            BaseArray <Base> c = new BaseArray <Base>(3);

            c.Array[0] = new Base();
            c.Array[1] = new Derived();

            BaseArray <Derived> e = new BaseArray <Derived>(3);

            d.Array[0] = new Derived();
            d.Array[1] = CreatedInstance <Derived>();
            d.Array[2] = CreatedInstance <Derived>();

            BaseArray <Derived> e = new BaseArray <Derived>(3);

            e.CopyArray <Derived>(d.Array);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            StructArray <int> a = new StructArray <int>(3);

            // StructArray<string> b = new StructArray<string>(3); 스트링은 참조형식이라서 사용못함 where  T : struct이기 때문에

            BaseArray <Base> c = new BaseArray <Base>(3);

            c.Array[0] = new Base();
            c.Array[1] = new Derived();
            c.Array[2] = CreatedInstance <Base>();   // Base도 가능, Derived도 가능

            BaseArray <Derived> e = new BaseArray <Derived>(3);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            StructArray <int> a = new StructArray <int>(3);

            a.Array[0] = 0;

            // RefArray<>

            BaseArray <Base> c = new BaseArray <Base>(3);

            c.Array[0] = new Base();
            c.Array[1] = new Derived();
            c.Array[2] = CreatedInstance <Derived>();

            BaseArray <Derived> d = new BaseArray <Derived>(3);
        }