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

◆ ConvertFrom() [1/2]

override? object System.ComponentModel.CharConverter.ConvertFrom ( ITypeDescriptorContext? context,
CultureInfo? culture,
object value )
inlinevirtual

Reimplemented from System.ComponentModel.TypeConverter.

Definition at line 25 of file CharConverter.cs.

26 {
27 string text = value as string;
28 if (text != null)
29 {
30 if (text.Length > 1)
31 {
32 text = text.Trim();
33 }
34 if (text.Length > 0)
35 {
36 if (text.Length != 1)
37 {
38 throw new FormatException(System.SR.Format(System.SR.ConvertInvalidPrimitive, text, "Char"));
39 }
40 return text[0];
41 }
42 return '\0';
43 }
44 return base.ConvertFrom(context, culture, value);
45 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string ConvertInvalidPrimitive
Definition SR.cs:20
Definition SR.cs:7

References System.SR.ConvertInvalidPrimitive, System.culture, System.SR.Format(), System.text, and System.value.