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
typeType
Returns
ConvertType(object?, Type)
Converts the specified value to the specified type.
public static object? ConvertType(object? value, Type type)
Parameters
Returns
- object
The converted type, or
nullifvalueisnullandtypeis a nullable type.
Exceptions
- FormatException
valueis not compatible withtype.
GetDefaultValue(Type)
Gets the default value for the specified type.
public static object? GetDefaultValue(Type type)
Parameters
typeType
Returns
- object
The default value, or
nullfor nullable value types and reference types.