>Declare the variable as IFormattable. Though, String does not implement
>this
>interface, but for the String type, it doesn't make sense to call this
>overloaded ToString version anyway because it doesn't do a conversion.
>
That sounds good. I can do something like this:
>
If TypeOf MyObj Is IFormattable Then
MyString = CType(MyObj, IFormattable).ToString(Nothing,
CultureInfo.InvariantCulture)
Else
MyString = MyObject.ToString
End If
>
Actually String *does* implement this overload (does no conversion though),
so I don't think I need the check on the object type at all (I know for this
application that it will always be a simple generic type, not an array nor a
class instance).