
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
Literal number suffixes in C#
To specify number types, use suffixes in C#. Literal number suffixes are numeric suffixes.
For example, for long type −
// long suffix long val1 = 29345L;
For double type −
// double suffix double val2 = 297.325D; Console.WriteLine(val2);
Let us see more examples −
Example
using System.IO; using System; public class Program { public static void Main() { // long suffix long val1 = 29345L; Console.WriteLine(val1); // decimal suffix decimal val5 = 3245.5678M; Console.WriteLine(val5); // double suffix double val2 = 297.325D; Console.WriteLine(val2); // float suffix float val3 = 250.35F; Console.WriteLine(val3); // unsigned suffix uint val4 = 3456U; Console.WriteLine(val4); } }
Output
29345 3245.5678 297.325 250.35 3456
- Related Articles
- Integer literal in C/C++ (Prefixes and Suffixes)
- Lowercase suffixes in C#
- Raw string literal in C++
- Raw string literal in C++ program
- What is 0 (zero) - A decimal literal or An octal literal in C++
- What is a string literal in C++?
- String Literal Vs String Object in C#
- Trie of all Suffixes
- Sum of similarities of string with all of its suffixes in C++
- How to define multiline String Literal in C#?
- How to write a short literal in C++?
- What is the difference between literal and constant in C++?
- What is the difference between literal and constant in C#?
- Hexadecimal integer literal in Java
- Is null a literal in Java?

Advertisements