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?
IFormatProvider with Integer value
6k Views Asked by Charitha At
4
There are 4 best solutions below
0

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.
see here: IFormatProvider Interface