C#關鍵字
關鍵字是保留字,在程序代碼中不能將其用作變量名稱,常量名稱等。
在 C# 關鍵字不能用作標識符。但是,如果要使用關鍵字作爲標識符,我們可以使用@
字符加到關鍵字的前面,如:[@class](https://github.com/class "@class")
, [@private](https://github.com/private "@private")
等。
C# 編程語言中可用的保留關鍵字如下列表:
abstract
base
as
bool
break
catch
case
byte
char
checked
class
const
continue
decimal
private
protected
public
return
readonly
ref
sbyte
explicit
extern
false
finally
fixed
float
for
foreach
goto
if
implicit
in
in (generic modifier)
int
ulong
ushort
unchecked
using
unsafe
virtual
void
null
object
operator
out
out (generic modifier)
override
params
default
delegate
do
double
else
enum
event
sealed
short
sizeof
stackalloc
static
string
struct
switch
this
throw
true
try
typeof
uint
abstract
base
as
bool
break
catch
case
volatile
while
-
-
-
-
-