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

◆ ConvertTo() [1/2]

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

Reimplemented from System.ComponentModel.TypeConverter.

Reimplemented in System.ComponentModel.DecimalConverter.

Definition at line 60 of file BaseNumberConverter.cs.

61 {
62 if (destinationType == null)
63 {
64 throw new ArgumentNullException("destinationType");
65 }
66 if (destinationType == typeof(string) && value != null && TargetType.IsInstanceOfType(value))
67 {
68 if (culture == null)
69 {
71 }
73 return ToString(value, numberFormatInfo);
74 }
75 if (destinationType.IsPrimitive)
76 {
77 return Convert.ChangeType(value, destinationType, culture);
78 }
79 return base.ConvertTo(context, culture, value, destinationType);
80 }
static CultureInfo CurrentCulture

References System.Convert.ChangeType(), System.culture, System.Globalization.CultureInfo.CurrentCulture, System.Globalization.NumberFormatInfo.GetFormat(), System.Type.IsInstanceOfType(), System.Type.IsPrimitive, System.ToString, and System.value.