This is used to allow you to use reserved words as identifiers such as class names, delegates and methods. For example: long
:
namespace ConsoleApp4
{
internal class Program
{
private static void Main(string[] args)
{
@long();
}
public static void @long ()
{
// Some logic here
}
}
}
Remove the @
and it won't compile. It isn't often used.
Note that the code will compile fine if you change both long
to long2
and remove the second @
. So the use of @
means you can call a method name that is a reserved word - but it will also work if the method name is not a reserved word.
Note that the @ prefix does not form part of the identifier itself. So @myVariable is the same as myVariable.