Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 08:28, 19 August 2025 by Dylan (talk | contribs) (new: info, size, example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The long class in C Sharp is a data type which can store positive and negative whole numbers in variables.

See Integer for generic information about what integers and longs can represent and how they are represented in memory.

A long in C# is represented by 8 bytes, or 64 bits.

This means it can store integral values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

For less extreme integers (anything between -2,147,483,648 to 2,147,483,647), you can use the C Sharp int data type instead, which uses less space in memory.

long a;
long b = 74;
long c = (long)15.2; // 15