public T Read <T>() where T : IPacketable <T>, new() { ReadData <T> data = PacketableHandler.Read(new T(), this); currentReadPosition = data.bytesRead; return(data.data); }
public T[] ReadArray <T>() where T : IPacketable <T>, new() { int size = ReadInt(); T[] arr = new T[size]; for (int i = 0; i < size; i++) { ReadData <T> data = PacketableHandler.Read(new T(), this); currentReadPosition = data.bytesRead; arr[i] = data.data; } return(arr); }