Table of Contents

Class RuntimeTypeConverter

Namespace
JsonApiDotNetCore.Resources
Assembly
JsonApiDotNetCore.Annotations.dll

Provides utilities regarding runtime types.

[PublicAPI]
public static class RuntimeTypeConverter
Inheritance
RuntimeTypeConverter
Inherited Members

Methods

CanContainNull(Type)

Indicates whether the specified type is a nullable value type or a reference type.

public static bool CanContainNull(Type type)

Parameters

type Type

Returns

bool

ConvertType(object?, Type)

Converts the specified value to the specified type.

public static object? ConvertType(object? value, Type type)

Parameters

value object

The value to convert from.

type Type

The type to convert to.

Returns

object

The converted type, or null if value is null and type is a nullable type.

Exceptions

FormatException

value is not compatible with type.

GetDefaultValue(Type)

Gets the default value for the specified type.

public static object? GetDefaultValue(Type type)

Parameters

type Type

Returns

object

The default value, or null for nullable value types and reference types.