Why can\'t you assign a number with a decimal point to the decimal type directly without using type suffix? isn\'t this kind of number considered a number of type decimal?
Edit: I may have missed the last part of the question, so the overview below is hardly useful.
Anyway, the reason you can't do what you're trying to do is because there is no implicit conversion between floating point types and decimal
. You can however assign it from an integer, as there is an implicit conversion from int to decimal.
You can, but you have to use this syntax (or do an explicit cast to decimal).
decimal bankBalance = 3433.20m;
and for floats it is
float bankBalance = 3433.20f;
default is double
double bankBalance = 3444.20;