<PackageReference Include="System.Drawing.Common" Version="10.0.0-preview.4.25258.110" />

BinaryFormatWriter

static class BinaryFormatWriter
Writer that writes specific types in binary format without using the BinaryFormatter.
public static bool TryWrite<T>(Action<Stream, T> action, Stream stream, T value)

Simple wrapper to ensure the stream is reset to its original position if the action throws.

public static bool TryWrite<T>(Func<Stream, T, bool> func, Stream stream, T value)

Simple wrapper to ensure the stream is reset to its original position if the func throws or returns false.

public static bool TryWriteArray(Stream stream, Array array)

Writes the given array in binary format if supported.

public static bool TryWriteArrayList(Stream stream, ArrayList list)

Writes the given list in binary format if supported.

public static bool TryWriteDrawingPrimitivesObject(Stream stream, object value)

Writes the given value to stream, only types that have TypeConverters are supported. This function is needed for the Clipboard serialization as Clipboard is not using TypeConverters.

public static bool TryWriteFrameworkObject(Stream stream, object value)

Writes the given value if supported.

public static bool TryWriteHashtable(Stream stream, Hashtable hashtable)

Tries to write the given hashtable if supported.

public static bool TryWriteJsonData(Stream stream, object value)

public static bool TryWritePrimitive(Stream stream, object primitive)

Attempts to write a PrimitiveType value in binary format.

public static bool TryWritePrimitiveList(Stream stream, IList list)

Writes the given list in binary format if supported.

public static void WriteColor(Stream stream, Color value)

Writes a Color in binary format.

public static void WriteDateTime(Stream stream, DateTime value)

Writes a DateTime in binary format.

public static void WriteDecimal(Stream stream, decimal value)

Writes a decimal in binary format.

public static void WriteNativeInt(Stream stream, IntPtr value)

Writes a nint in binary format.

public static void WriteNativeUInt(Stream stream, UIntPtr value)

Writes a nuint in binary format.

public static void WriteNotSupportedException(Stream stream, NotSupportedException exception)

Writes a NotSupportedException in binary format.

public static void WritePoint(Stream stream, Point value)

Writes a Point in binary format.

public static void WritePointF(Stream stream, PointF value)

Writes a PointF in binary format.

public static void WritePrimitive(Stream stream, object primitive)

Writes a .NET primitive value in binary format.

public static void WritePrimitiveHashtable(Stream stream, Hashtable hashtable)

Writes a Hashtable of primitive to primitive values to the given stream in binary format.

Writes a primitive list in binary format.

public static void WriteRectangle(Stream stream, Rectangle value)

Writes a Rectangle in binary format.

public static void WriteRectangleF(Stream stream, RectangleF value)

Writes a RectangleF in binary format.

public static void WriteSize(Stream stream, Size value)

Writes a Size in binary format.

public static void WriteSizeF(Stream stream, SizeF value)

Writes a SizeF in binary format.

public static void WriteString(Stream stream, string value)

Writes a string in binary format.

public static void WriteStringList(Stream stream, List<string> list)

Writes a List<T> in binary format.

public static void WriteTimeSpan(Stream stream, TimeSpan value)

Writes a TimeSpan in binary format.