Exemple #1
0
        public static T[] ReadArray <T>(this BinaryReader reader, int size) where T : struct
        {
            int numBytes = FastStruct <T> .Size * size;

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

            return(FastStruct <T> .ReadArray(result));
        }
Exemple #2
0
        public static T Read <T>(this BinaryReader reader) where T : struct
        {
            byte[] result = reader.ReadBytes(FastStruct <T> .Size);

            return(FastStruct <T> .ArrayToStructure(result));
        }
Exemple #3
0
        public static T Read <T>(this BinaryReader reader, int byteCount) where T : struct
        {
            byte[] result = reader.ReadBytes(byteCount == 0 ? FastStruct <T> .Size : byteCount);

            return(FastStruct <T> .ArrayToStructure(result));
        }