Use the long reserved word as a variable name in C#

Solution 1:

Yes, you can if you really want to:

private string @long;

The actual name of the variable (as reported by reflection etc) is just long; the @ sign tells the compiler to ignore the fact that it's also a keyword.

I would very strongly advise against this, however.

Solution 2:

As others have mentioned, you can escape a reserved word with @.

In your example you don't really need to, I would write the property like this:

private string _long;
public string Long 
{ 
    get
    {
        return _long;
    }
}

And the underscore and the capital L make it compile.

But it's kind of a tradition to call them Lat and Lon, or even better: Latitude and Longitude.

Solution 3:

Yes, you can. Using the @ symbol.
This will work, for example: private string @long;
Doing this is highly not recommended, but it is possible.