public static void FillPackedArray (IntFloatPair[] array) {
     for (var i = 0; i < array.Length; i++)
         array[i] = new IntFloatPair {
             Int = i,
             Float = i * 1.5f
         };
 }
    public static unsafe void Main (string[] args) {
        PackedArray[1] = new IntFloatPair {
            Int = 1,
            Float = 3.14f
        };

        fixed (IntFloatPair* pStruct = &PackedArray[1])
            Console.WriteLine(*pStruct);
    }
    public static unsafe void Main(string[] args)
    {
        PackedArray[1] = new IntFloatPair {
            Int   = 1,
            Float = 3.14f
        };

        fixed(IntFloatPair *pStruct = &PackedArray[1])
        Console.WriteLine(*pStruct);
    }
Example #4
0
    public static void FillPackedArray(IntFloatPair[] array)
    {
        for (var i = 0; i < array.Length; i++)
        {
            array[i] = new IntFloatPair {
                Int   = i,
                Float = i * 1.5f
            }
        }
        ;
    }
}
    public static unsafe void Main (string[] args) {
        PackedArray[0] = new IntFloatPair {
            Int = 1,
            Float = 2.22f
        };
        PackedArray[1] = PackedArray[0];

        PackedArray[0].Int += 2;
        PackedArray[0].Float += 1.1f;

        foreach (var item in PackedArray)
            Console.WriteLine(item);
    }
    public static unsafe void Main(string[] args)
    {
        PackedArray[0] = new IntFloatPair {
            Int   = 1,
            Float = 2.22f
        };
        PackedArray[1] = PackedArray[0];

        PackedArray[0].Int   += 2;
        PackedArray[0].Float += 1.1f;

        foreach (var item in PackedArray)
        {
            Console.WriteLine(item);
        }
    }
Example #7
0
    public static unsafe void Main (string[] args) {
        foreach (var item in PackedArray)
            Console.WriteLine(item);

        PackedArray[0] = new IntFloatPair {
            Int = 1,
            Float = 2
        };
        PackedArray[1] = new IntFloatPair {
            Int = 3,
            Float = 4
        };

        foreach (var item in PackedArray)
            Console.WriteLine(item);
    }
Example #8
0
    public static unsafe void Main (string[] args) {
        var bytes = new byte[8];

        fixed (byte* pBytes = bytes) {
            var pStruct = (IntFloatPair*)pBytes;
            *pStruct = new IntFloatPair {
                Int = 2,
                Float = 3.5f
            };
        }

        for (var i = 0; i < bytes.Length; i++)
            Console.Write("{0:X2} ", bytes[i]);

        Console.WriteLine();
    }
Example #9
0
    public static unsafe void Main(string[] args)
    {
        var bytes = new byte[8];

        fixed(byte *pBytes = bytes)
        {
            var pStruct = (IntFloatPair *)pBytes;

            *pStruct = new IntFloatPair {
                Int   = 2,
                Float = 3.5f
            };
        }

        for (var i = 0; i < bytes.Length; i++)
        {
            Console.Write("{0:X2} ", bytes[i]);
        }

        Console.WriteLine();
    }
Example #10
0
    public static unsafe void Main(string[] args)
    {
        foreach (var item in PackedArray)
        {
            Console.WriteLine(item);
        }

        PackedArray[0] = new IntFloatPair {
            Int   = 1,
            Float = 2
        };
        PackedArray[1] = new IntFloatPair {
            Int   = 3,
            Float = 4
        };

        foreach (var item in PackedArray)
        {
            Console.WriteLine(item);
        }
    }
 public static void FillPackedArray(IntFloatPair[] array)
 {
     Console.WriteLine(array.Length);
 }