How to call TypeConverter.ConvertTo or ConvertToString with InvariantCulture, but without implementing ITypeDescriptorContext

In my conversion method, I get the wrong number separators when I use TypeConverter.ConvertToString(Object) because my system is in German. There is another overload for this method, which looks like this: TypeConverter.ConvertToString(ITypeDescriptorContext, CultureInfo, Object) .

Is there any reasonable way to get ITypeDescriptorContext or another option to call this method using InvariantCulture besides switching the culture before and after?

+7
tostring c # localization
source share
1 answer

You can pass null as a parameter

 TypeConverter.ConvertToString(null, CultureInfo.InvariantCulture, Object); 
+11
source share

All Articles