Method IsSerializable
- Namespace
- Xunit.Sdk
- Assembly
- xunit.v3.common.dll
IsSerializable(T, out string?)
Determines if a specific value of data is serializable.
public virtual bool IsSerializable(T value, out string? failureReason)
Parameters
valueTThe value to test
failureReasonstringReturns a failure reason when the value isn't serializable
Returns
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.
When value is an array, this method will be called once for each element
in the array. This differs in behavior from IsSerializable(Type, object?, out string?), which
is only called once with the array passed in value.
The default implementation of this method just returns true; you only need to override
this if there are situations values might not be serializable (for example, if the custom type
contains potentially non-serializable data).