Letter after a number, what is this called?

Asked

Viewed 681 times

6

What’s the name of it?

double  d1 = 0d;
decimal d2 = 0L;
float   d3 = 0f;

And where can I find a reference of the characters I can use? If I want to make one cast of 0 for short, there is some letter for this?

1 answer

11


What’s the name of it?

There’s no proper name for it, it’s usually referred to as suffix (suffix, Numeric suffix or suffix type).

And where I can find a reference of the characters I can use?

You can find a reference of the characters used by C# at that link (spine Type Suffix). Basically are:

  • M or m for decimal.
  • D or d for double.
  • F or f for float.
  • L or l for long.
  • U or u for uint.
  • UL or ul for ulong.

It is optional to write in upper or lower case, but recommended for type long use the uppercase form so as not to confuse it with the character 1 (one).

If I want to cast 0 for short, there are some lyrics for this?

No, the C# specification does not dedicate a suffix to the type shorts (nor to byte and char).


Curiosity: for the type ulong, besides UL and ul, any variation with the letters may be used L and U: Ul, uL, lu, LU, Lu, lU.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.