CommonTypeConvertToString(Object, CultureInfo, Boolean) Method

Converts value to a String using an appropriate TypeConverter.

Definition

Namespace: Gemstone
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.150 -- Release Build+64e3b411e1abfbd2d4d8a81e850c3909a0ce8731
public static string TypeConvertToString(
	Object? value,
	CultureInfo? culture,
	bool throwOnFail = false
)

Parameters

value  Object
Value to convert to a String.
culture  CultureInfo
CultureInfo to use for the conversion.
throwOnFail  Boolean  (Optional)
Set to true to throw exception if conversion fails; otherwise, false to fall back on .ToString().

Return Value

String
value converted to a String.

Remarks

If TypeConverter fails, the value's ToString() value will be returned. Returned value will never be null, if no value exists an empty string ("") will be returned.

You can use the ConvertToTypeT(String, CultureInfo) string extension method or [!:TypeConvertFromString(string, Type, CultureInfo)] to convert the string back to its original Type.

See Also