C# Language long


Example

The long keyword is used to represent signed 64-bit integers. It is an alias for the System.Int64 datatype present in mscorlib.dll, which is implicitly referenced by every C# project when you create them.

Any long variable can be declared both explicitly and implicitly:

long long1 = 9223372036854775806;  // explicit declaration, long keyword used
var long2 = -9223372036854775806L; // implicit declaration, 'L' suffix used

A long variable can hold any value from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, and can be useful in situations which a variable must hold a value that exceeds the bounds of what other variables (such as the int variable) can hold.