public byte[] Write <T>(T packet) where T : class, new() { _netDataWriter.Reset(); WriteHash(typeof(T), _netDataWriter); _netSerializer.Serialize(_netDataWriter, packet); return(_netDataWriter.CopyData()); }
/// <summary> /// Serialize struct to byte array /// </summary> /// <param name="obj">Object to serialize</param> /// <returns>byte array with serialized data</returns> public byte[] Serialize <T>(T obj) where T : class, new() { _writer.Reset(); Serialize(_writer, obj); return(_writer.CopyData()); }