/// <summary> /// GetBytes Written in Binary /// </summary> /// <returns>Array Of Bytes</returns> public byte[] GetBytes() { if (OutStream is MemoryStream stream) { return(stream.ToArray()); } using (var memoryStream = new MemoryStream()) { memoryStream.GetBuffer(); OutStream.CopyTo(memoryStream); return(memoryStream.ToArray()); } }