What is ‘long?’ data type?

long is the same as Int64

long data type

The ? means it is nullable

A nullable type can represent the
normal range of values for its
underlying value type, plus an
additional null value

Nullable Types

Nullable example:

int? num = null;
if (num.HasValue == true)
{
    System.Console.WriteLine("num = " + num.Value);
}
else
{
    System.Console.WriteLine("num = Null");
}

This allows you to actually check for a null value instead of trying to assign an arbitrary value to something to check to see if something failed.

I actually wrote a blog post about this here.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)