Literals

In this chapter you will learn:

  1. What are the literial for value data types

Literals

literals refer to fixed values that are represented in their human-readable form.

  • To specify a long literal, append an l or an L. For example, 12 is an int, but 12L is a long.
  • To specify an unsigned integer value, append a u or U. Thus, 100 is an int, but 100U is a uint.
  • To specify an unsigned, long integer, use ul or UL. For example, 984375UL is of type ulong.
  • To specify a float literal, append an F or f to the constant. For example, 10.19F is of type float.
  • To specify a decimal literal, follow its value with an m or M. For example, 9.95M is a decimal literal.

A hexadecimal literal must begin with 0x (a zero followed by an x).

Next chapter...

What you will learn in the next chapter:

  1. Data type default value
Home » C# Tutorial » Data Types
C# Data Types
Value type vs reference type
Literals
Value default value
Anonymous type