Created
October 17, 2013 09:57
-
-
Save maniserowicz/7022229 to your computer and use it in GitHub Desktop.
format any object using CultureInfo.InvariantCulture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string ToInvariantString(this object @this) | |
{ | |
var formattable = @this as IFormattable; | |
if (formattable != null) | |
{ | |
return formattable.ToString(null, CultureInfo.InvariantCulture); | |
} | |
return @this.ToString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment