/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> public void Dispose() { lock (this) { if (!Disposed) { Disposed = true; GC.SuppressFinalize(this); if (FMemoryStream != null) { FMemoryStream.Close(); FMemoryStream.Dispose(); FMemoryStream = null; } if (FWriter != null) { FWriter.Close(); FWriter.Dispose(); FWriter = null; } if (FReader != null) { FReader.Close(); FReader.Dispose(); FReader = null; } } } }
/// <summary> /// Initializes a new instance of the <see cref="FastBinaryFormatter"/> class. /// </summary> public FastBinaryFormatter() { Disposed = false; FLengthBuffer = new byte[Marshal.SizeOf(typeof(int))]; FCopyBuffer = new byte[STREAM_MAX_CAPACITY]; FMemoryStream = new MemoryStream(STREAM_MAX_CAPACITY); FWriter = new FastBinaryWriter(FMemoryStream); FReader = new FastBinaryReader(FMemoryStream); }
void IFastBinarySerializable.WriteData(FastBinaryWriter writer, object additonalInfo) { writer.Write(Items.Cast <IFastBinarySerializable>().ToArray()); }
/// <summary> /// Writes the data. /// </summary> /// <param name="writer">The writer.</param> /// <param name="additionalInfo">The additional information.</param> public virtual void WriteData(FastBinaryWriter writer, object additionalInfo) { writer.WriteByteArray(ObjectData); }