public MediumStruct echoMediumStruct(/*[in]*/ MediumStruct arg)
 {
     return(arg);
 }
示例#2
0
 MediumStruct MediumStructGeneric <T>(MediumStruct x)
 {
     return(x);
 }
示例#3
0
        public static void Run()
        {
            var o = new TestDelegateFatFunctionPointers();

            string hw        = "Hello World";
            string roundtrip = o.Generic <string>(hw);

            if (roundtrip != hw)
            {
                throw new Exception();
            }

            {
                VoidGenericDelegate <object> f = o.VoidGeneric;
                object obj      = new object();
                object location = null;
                f(ref location, obj);
                if (location != obj)
                {
                    throw new Exception();
                }
            }

            {
                Func <SmallStruct, SmallStruct> f = o.SmallStructGeneric <object>;
                SmallStruct x = new SmallStruct {
                    X = 12345
                };
                SmallStruct result = f(x);
                if (result.X != x.X)
                {
                    throw new Exception();
                }
            }

            {
                Func <MediumStruct, MediumStruct> f = o.MediumStructGeneric <object>;
                MediumStruct x = new MediumStruct {
                    X = 12, Y = 34, Z = 56, W = 78
                };
                MediumStruct result = f(x);
                if (result.X != x.X || result.Y != x.Y || result.Z != x.Z || result.W != x.W)
                {
                    throw new Exception();
                }
            }

            unsafe
            {
                Func <BigStruct, BigStruct> f = o.BigStructGeneric <object>;
                BigStruct x = new BigStruct();
                for (int i = 0; i < BigStruct.Length; i++)
                {
                    x.Bytes[i] = (byte)(i * 2);
                }

                BigStruct result = f(x);

                for (int i = 0; i < BigStruct.Length; i++)
                {
                    if (x.Bytes[i] != result.Bytes[i])
                    {
                        throw new Exception();
                    }
                }
            }
        }
示例#4
0
 public MediumStruct echoMediumStruct(/*[in]*/MediumStruct arg)
 {
     return arg;
 }