internal static string StringConverter(StringOrPrimitive <T> val) { if (val.StringValue != null) { return(val.StringValue); } else { return("" + val.PrimitiveValue); } }
internal StringOrPrimitive <T> ValueConverter(string stringVal) { StringOrPrimitive <T> stringOrPrimitive = null; if (IsLegalString(stringVal)) { stringOrPrimitive = new StringOrPrimitive <T>(stringVal); } else { T value; if (_tryParse(stringVal, out value)) { stringOrPrimitive = new StringOrPrimitive <T>(value); } else { var message = string.Format(CultureInfo.CurrentCulture, Resources.ConversionExceptionMessage, value); throw new ConversionException(message); } } return(stringOrPrimitive); }