I have an Integer value in my object. I need to cast it as an integer value. So I have done it this way. System.Convert.ToInt64(Object) But FxCop said that I need to provide with IFormatProvider. String data type I have no issue with provide IFormatProvider. How can I provide an IFormatProvider for integer value?
It depends on how you need to print your value.
e.g. using:
var provider = System.Globalization.CultureInfo.InvariantCulture;
you will get a string that is independent from your local (regional) settings.
Using:
var provider = System.Globalization.CultureInfo.CurrentCulture;
or:
var provider = System.Globalization.CultureInfo.CurrentUICulture;
instead, the string will be printed using your local (regional) machine settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With