Class ConverterExtensions

Namespace
Cratis.Arc
Assembly
Cratis.Arc.Core.dll

Provides methods for converting values between different types.

public static class ConverterExtensions
Inheritance
ConverterExtensions
Inherited Members

Methods

ConvertTo(object, Type)

Converts a value to the specified target type, handling concepts, enumerables and nullable types.

public static object? ConvertTo(this object value, Type targetType)

Parameters

value object

The value to convert.

targetType Type

The target type to convert to.

Returns

object

The converted value.

Remarks

Supports converting primitives to their ConceptAs<T> counterparts, and a delimited string (as produced by repeated query string keys collapsed into one value) into an enumerable of primitives, concepts, or enums.

Exceptions

InvalidCollectionQueryArgument

The collection shape or an element is invalid.