Lowercase suffixes in C#



Set lowercase suffixes for literals such as u, l, ul, f, etc.

// l for long
long a = 29876l;

It can be used on literal numbers as well. It tells the compiler that the literal is of a specific type.

The following is an example −

Example

 Live Demo

using System.IO;
using System;
public class Program {
   public static void Main() {
      long a = 29876l;
      float b = 95.10f;
      Console.WriteLine(a);
      Console.WriteLine(b);
   }
}

On running the above example, you will get the following output. With that, you will also get a message “The `l' suffix is easily confused with the digit `1' (use `L' for clarity)”. Therefore,

Output

29876
95.1
Updated on: 2020-06-22T14:42:40+05:30

151 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements