Skip to content

Instantly share code, notes, and snippets.

@maniserowicz
Created October 17, 2013 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maniserowicz/7022229 to your computer and use it in GitHub Desktop.
Save maniserowicz/7022229 to your computer and use it in GitHub Desktop.
format any object using CultureInfo.InvariantCulture
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