Lowercase suffixes in C#

CsharpProgrammingServer Side Programming

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
raja
Published on 05-Sep-2018 11:51:14
Advertisements