Method IsSerializable
- Namespace
- Xunit.Sdk
- Assembly
- xunit.v3.common.dll
IsSerializable(Type, object?, out string?)
Determines if a specific value of data is serializable.
bool IsSerializable(Type type, object? value, out string? failureReason)
Parameters
typeTypeThe type of the value
valueobjectThe value to test
failureReasonstringReturns a failure reason when the value isn't serializable
Returns
- bool
Return
trueif the value is serializable;false, otherwise
Remarks
This will be called by IsSerializable(object?),
IsSerializable(object?, Type?), and
Serialize(object?, Type?). The failure reason is used when
called from Serialize to format an error exception, but is otherwise ignored
from the calls from IsSerializable.
The type of value may not directly match type, as the type
is derived from unwrapping nullability and array element types, so use care when looking
at the value to determine serializability.