I renamed a class with name static, i have compile time error
public class static
{
}
Error CS0116 A namespace cannot directly contain members such as fields or
I renamed a class with name static, i have compile time error
public class static
{
}
Error CS0116 A namespace cannot directly contain members such as fields or
it's really a bad idea to use reserved keyword as a class name, but here is the way to do it
public class @static
{
....
}
//create a instance of class static
var temp = new @static();
Short answer you dont
Keywords are predefined, reserved identifiers that have special meanings to the compiler. They cannot be used as identifiers in your program unless they include @ as a prefix. For example, @if is a valid identifier, but if is not because if is a keyword. The first table in this topic lists keywords that are reserved identifiers in any part of a C# program. The second table in this topic lists the contextual keywords in C#. Contextual keywords have special meaning only in a limited program context and can be used as identifiers outside that context. Generally, as new keywords are added to the C# language, they are added as contextual keywords in order to avoid breaking programs written in earlier versions.
you can find more info here
however you can as pointed out in the comments use the prefixed @ symbol, however this is serious code smell