コード例 #1
0
        public static T[] ReadArray <T>(this BinaryReader reader) where T : struct
        {
            int numBytes = (int)reader.ReadInt64();

            byte[] result = reader.ReadBytes(numBytes);

            reader.BaseStream.Position += (0 - numBytes) & 0x07;
            return(FastStruct <T> .ReadArray(result));
        }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: lyragosa/aleph
        public unsafe static T[] ReadArray <T>(this BinaryReader reader) where T : struct
        {
            int numBytes = (int)reader.ReadInt64();

            byte[] result = reader.ReadBytes(numBytes);

            fixed(byte *ptr = result)
            {
                T[] data = FastStruct <T> .ReadArray((IntPtr)ptr, numBytes);

                reader.BaseStream.Position += (0 - numBytes) & 0x07;
                return(data);
            }
        }