Decimal? type is not culture specific

I converted a decimalto stringusing the following lines of code:

decimal a = 0;
a.ToString();

and Resharper gave me the following warning: "Provide an explanation of string culture." I guess this makes sense, as some cultures may use ".". (period) or "," (comma) as a decimal mark.

However, the following lines of code:

decimal? a = 0; //a is now nullable
a.ToString();

Do not present the same warning. I was wondering if this is a bug in Resharper, or is there something special in nullable decimal?

+4
source share
2 answers

Gama Felix , , , decimal?.ToString() , . , . , decimal?.Value.ToString().

+6

, , decimal? Nulable<decimal>, ToString() , .

+3

Source: https://habr.com/ru/post/1615448/


All Articles