Table of Contents

Method IsType

Namespace
Xunit
Assembly
xunit.v3.assert.dll

IsType<T>(object?)

Verifies that an object is exactly the given type (and not a derived type).

public static T IsType<T>(object? @object)

Parameters

object object

The object to be evaluated

Returns

T

The object, casted to type T when successful

Type Parameters

T

The type the object should be

Exceptions

Thrown when the object is not the given type

IsType<T>(object?, bool)

Verifies that an object of is the given type.

public static T IsType<T>(object? @object, bool exactMatch)

Parameters

object object

The object to be evaluated

exactMatch bool

Will only pass with an exact type match when true is passed; will pass with a compatible type match when false is passed.

Returns

T

The object, casted to type T when successful

Type Parameters

T

The type the object should be

Exceptions

Thrown when the object is not the given type

IsType(Type, object?)

Verifies that an object is exactly the given type (and not a derived type).

public static void IsType(Type expectedType, object? @object)

Parameters

expectedType Type

The type the object should be

object object

The object to be evaluated

Exceptions

Thrown when the object is not the given type

IsType(Type, object?, bool)

Verifies that an object is of the given type.

public static void IsType(Type expectedType, object? @object, bool exactMatch)

Parameters

expectedType Type

The type the object should be

object object

The object to be evaluated

exactMatch bool

Will only pass with an exact type match when true is passed; will pass with a compatible type match when false is passed.

Exceptions

Thrown when the object is not the given type