Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ConvertTo() [1/2]

override? object System.ComponentModel.NullableConverter.ConvertTo ( ITypeDescriptorContext? context,
CultureInfo? culture,
object? value,
Type destinationType )
inlinevirtual

Reimplemented from System.ComponentModel.TypeConverter.

Definition at line 78 of file NullableConverter.cs.

79 {
80 if (destinationType == null)
81 {
82 throw new ArgumentNullException("destinationType");
83 }
84 if (destinationType == UnderlyingType && value != null && NullableType.IsInstanceOfType(value))
85 {
86 return value;
87 }
88 if (destinationType == typeof(InstanceDescriptor))
89 {
91 return new InstanceDescriptor(member, new object[1] { value }, isComplete: true);
92 }
93 if (value == null)
94 {
95 if (destinationType == typeof(string))
96 {
97 return string.Empty;
98 }
99 }
100 else if (UnderlyingTypeConverter != null)
101 {
102 return UnderlyingTypeConverter.ConvertTo(context, culture, value, destinationType);
103 }
104 return base.ConvertTo(context, culture, value, destinationType);
105 }
static readonly ConstructorInfo s_nullableConstructor
object? ConvertTo(object? value, Type destinationType)
virtual MemberInfo GetMemberWithSameMetadataDefinitionAs(MemberInfo member)
Definition Type.cs:649
virtual bool IsInstanceOfType([NotNullWhen(true)] object? o)
Definition Type.cs:1020

References System.ComponentModel.TypeConverter.ConvertTo(), System.culture, System.Type.GetMemberWithSameMetadataDefinitionAs(), System.Type.IsInstanceOfType(), System.ComponentModel.NullableConverter.NullableType, System.ComponentModel.NullableConverter.s_nullableConstructor, System.ComponentModel.NullableConverter.UnderlyingType, System.ComponentModel.NullableConverter.UnderlyingTypeConverter, and System.value.