Class GenericValueObjectTypeConverter
Namespace: AdCodicem.ValueObjects.Metadata
Assembly: AdCodicem.ValueObjects.Abstractions.dll
Converts each construction of a generic value object to and from text and its underlying value.
public sealed class GenericValueObjectTypeConverter : TypeConverter
Inheritance
object ← TypeConverter ← GenericValueObjectTypeConverter
Inherited Members
TypeConverter.CanConvertFrom(ITypeDescriptorContext?, Type), TypeConverter.CanConvertFrom(Type), TypeConverter.CanConvertTo(ITypeDescriptorContext?, Type?), TypeConverter.CanConvertTo(Type?), TypeConverter.ConvertFrom(ITypeDescriptorContext?, CultureInfo?, object), TypeConverter.ConvertFrom(object), TypeConverter.ConvertFromInvariantString(ITypeDescriptorContext?, string), TypeConverter.ConvertFromInvariantString(string), TypeConverter.ConvertFromString(ITypeDescriptorContext?, CultureInfo?, string), TypeConverter.ConvertFromString(ITypeDescriptorContext?, string), TypeConverter.ConvertFromString(string), TypeConverter.ConvertTo(ITypeDescriptorContext?, CultureInfo?, object?, Type), TypeConverter.ConvertTo(object?, Type), TypeConverter.ConvertToInvariantString(ITypeDescriptorContext?, object?), TypeConverter.ConvertToInvariantString(object?), TypeConverter.ConvertToString(ITypeDescriptorContext?, CultureInfo?, object?), TypeConverter.ConvertToString(ITypeDescriptorContext?, object?), TypeConverter.ConvertToString(object?), TypeConverter.CreateInstance(IDictionary), TypeConverter.CreateInstance(ITypeDescriptorContext?, IDictionary), TypeConverter.GetCreateInstanceSupported(), TypeConverter.GetCreateInstanceSupported(ITypeDescriptorContext?), TypeConverter.GetProperties(ITypeDescriptorContext?, object), TypeConverter.GetProperties(ITypeDescriptorContext?, object, Attribute[]?), TypeConverter.GetProperties(object), TypeConverter.GetPropertiesSupported(), TypeConverter.GetPropertiesSupported(ITypeDescriptorContext?), TypeConverter.GetStandardValues(), TypeConverter.GetStandardValues(ITypeDescriptorContext?), TypeConverter.GetStandardValuesExclusive(), TypeConverter.GetStandardValuesExclusive(ITypeDescriptorContext?), TypeConverter.GetStandardValuesSupported(), TypeConverter.GetStandardValuesSupported(ITypeDescriptorContext?), TypeConverter.IsValid(ITypeDescriptorContext?, object?), TypeConverter.IsValid(object), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
The generator puts this converter in the [TypeConverter] attribute of a generic value object, where a value
object that is not generic names its own converter: an attribute cannot name a type through a type parameter.
It closes nothing at run time. A construction registered with
Constructors
GenericValueObjectTypeConverter(Type)
Initializes a new instance of the
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "A construction registered by hand, as native AOT requires, is found without reflection. Any other is described by the registry by reflection, which TypeDescriptor, itself reflection-based, already depends on.")]
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "A construction registered by hand, as native AOT requires, is found without reflection. Any other is described by the registry by reflection, which TypeDescriptor, itself reflection-based, already depends on.")]
public GenericValueObjectTypeConverter(Type type)
Parameters
type Type
The construction, Code<Order>, as
Exceptions
type is not a value object.
Methods
CanConvertFrom(ITypeDescriptorContext?, Type)
Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context.
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
Parameters
context ITypeDescriptorContext?
An
sourceType Type
A
Returns
true if this converter can perform the conversion; otherwise, false.
CanConvertTo(ITypeDescriptorContext?, Type?)
Returns whether this converter can convert the object to the specified type, using the specified context.
public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType)
Parameters
context ITypeDescriptorContext?
An
destinationType Type?
A
Returns
true if this converter can perform the conversion; otherwise, false.
ConvertFrom(ITypeDescriptorContext?, CultureInfo?, object)
Converts the given object to the type of this converter, using the specified context and culture information.
public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
Parameters
context ITypeDescriptorContext?
An
culture CultureInfo?
The
value object
The
Returns
An
Exceptions
The conversion cannot be performed.
The text or the value is not one the value object accepts.
ConvertTo(ITypeDescriptorContext?, CultureInfo?, object?, Type)
Converts the given value object to the specified type, using the specified context and culture information.
public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
Parameters
context ITypeDescriptorContext?
An
culture CultureInfo?
A
value object?
The
destinationType Type
The value parameter to.
Returns
An
Exceptions
The destinationType parameter is null.
The conversion cannot be performed.