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

◆ ConvertTo() [1/2]

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

Reimplemented from System.ComponentModel.TypeConverter.

Definition at line 62 of file SizeFConverter.cs.

63 {
64 if (destinationType == null)
65 {
66 throw new ArgumentNullException("destinationType");
67 }
68 if (value is SizeF sizeF)
69 {
70 if (destinationType == typeof(string))
71 {
72 if (culture == null)
73 {
75 }
76 string separator = culture.TextInfo.ListSeparator + " ";
77 TypeConverter converterTrimUnsafe = TypeDescriptor.GetConverterTrimUnsafe(typeof(float));
78 string[] value2 = new string[2]
79 {
80 converterTrimUnsafe.ConvertToString(context, culture, sizeF.Width),
81 converterTrimUnsafe.ConvertToString(context, culture, sizeF.Height)
82 };
83 return string.Join(separator, value2);
84 }
85 if (destinationType == typeof(InstanceDescriptor))
86 {
87 ConstructorInfo constructor = typeof(SizeF).GetConstructor(new Type[2]
88 {
89 typeof(float),
90 typeof(float)
91 });
92 if (constructor != null)
93 {
94 return new InstanceDescriptor(constructor, new object[2] { sizeF.Width, sizeF.Height });
95 }
96 }
97 }
98 return base.ConvertTo(context, culture, value, destinationType);
99 }
string? ConvertToString(object? value)
static TypeConverter GetConverterTrimUnsafe([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
static CultureInfo CurrentCulture

References System.ComponentModel.TypeConverter.ConvertToString(), System.culture, System.Globalization.CultureInfo.CurrentCulture, System.ComponentModel.TypeDescriptor.GetConverterTrimUnsafe(), and System.value.