Back to Nunit

BinarySerializable Constraint

docs/articles/nunit/writing-tests/constraints/BinarySerializableConstraint.md

latest889 B
Original Source

BinarySerializable Constraint

BinarySerializableConstraint tests whether an object is serializable in binary format.

Constructor

csharp
BinarySerializableConstraint()

Syntax

csharp
Is.BinarySerializable

Examples of Use

csharp
Assert.That(someObject, Is.BinarySerializable));

See also

[!WARNING] Binary Serialization is no longer supported in .NET 8 due to security concerns. From NUnit 4.x onward, this constraint is not available. More information can be found in these Microsoft Learn articles on BinaryFormatter's removal and on the BinaryFormatter security guide