Table of Contents

Method IsSerializable

Namespace
Xunit.Sdk
Assembly
xunit.v3.common.dll

IsSerializable(object?)

Determines if an object instance is serializable.

public bool IsSerializable(object? value)

Parameters

value object

The object to test for serializability.

Returns

bool

Returns true if the object can be serialized; false, otherwise.

Remarks

As null values always return true, even if the underlying type (which is unknown) might not be serializable, it's better to test via IsSerializable(object?, Type?) whenever possible.

IsSerializable(object?, Type?)

Determines if a given type supports serialization.

public bool IsSerializable(object? value, Type? type)

Parameters

value object

The object to test for serializability.

type Type

The type to test for serializability.

Returns

bool

Returns true if objects of the given type can be serialized; false, otherwise.