long data type C# bytes code example

Example 1: bytes size c#

public static string GetSizeInMemory(this long bytesize)
{


    string[] sizes = { "B", "KB", "MB", "GB", "TB" };
    double len = Convert.ToDouble(bytesize);
    int order = 0;
    while(len >= 1024D && order < sizes.Length - 1)
    {
        order++;
        len /= 1024;
    }

    return string.Format(CultureInfo.CurrentCulture,"{0:0.##} {1}", len, sizes[order]);
}

Example 2: c# data types

// -------DATA TYPES ------- //

sbyte myNum = 1;             // Smallest range of integer numbers
uint myNum = 3;				 // Only positive integer numbers
short myNum = 4;             // Short range of integer numbers
int myNum = 5;               // Integer (whole numbers)
long myNum = 10;             // Biggest range of integer numbers 
float myFloat = 1.2f;        // Smallest range of floating point numbers
double myDoubleNum = 5.99;   // Big range of floating point numbers
decimal myDecimalNum = 2.2M; // Biggest precision in floating point numbers
char myLetter = 'D';         // Character
string myString = "Hello!"   // Strings
bool myBool = true;          // Boolean