int
The C# type for 32-bit whole numbers from about minus 2.1 billion to 2.1 billion, used for counts, quantities and most identifiers.
In more detail
When an identifier could grow past 2.1 billion use long, which is 64 bits. int is a value type.
Examples
int quantity = 12;long productId = 9_000_000_000;Related terms
- value type — A type whose variables hold the data itself, so assigning one to another copies the whole value.
- decimal — The C# number type that stores base-10 digits exactly, with 28 to 29 significant digits, which makes it the right type for money.
- floating-point number — A number with a fractional part stored in binary, which can only approximate most decimal values.
Taught in
- The C# Language: Types, Variables, and Flow Control — Modern .NET Core, C# & Enterprise Microservices
- Collections, Generics, and LINQ — Modern .NET Core, C# & Enterprise Microservices