Search This Blog

Thursday, December 5, 2013

Long type C# Example

C# > Types > long

The long keyword is an integral type.
Range: –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Size: Signed 64-bit integer

Example:

long l = 21321321321;

long l1 = 21321321321L; // using suffix L

int i = 100L; // Error: Error 1 Cannot implicitly convert type 'long' to 'int'. An explicit conversion exists (are you missing a cast?)

int x = (int)100L; // OK