跳转到内容

C# 编程/关键字/default

来自维基教科书,开放的书籍,开放的世界

default 关键字可以在switch 语句或泛型代码中使用:[1]

  • switch 语句:指定默认标签。
  • 泛型代码:指定类型参数的默认值。对于引用类型,这将是 null,对于值类型,这将是零。

参考文献

[编辑 | 编辑源代码]
  1. "default (C# 参考)". http://msdn.microsoft.com/en-us/: MSDN. 检索于 2011-08-09. {{cite web}}: 外部链接在 |location= (帮助)



C# 关键字
abstract as base bool break
byte case catch char checked
class const continue decimal default
delegate do double else enum
event explicit extern false finally
fixed float for foreach goto
if implicit in int interface
internal is lock long namespace
new null object operator out
override params private protected public
readonly ref return sbyte sealed
short sizeof stackalloc static string
struct switch this throw true
try typeof uint ulong unchecked
unsafe ushort using var virtual
void volatile while
特殊 C# 标识符(上下文关键字)
add alias async await dynamic
get global nameof partial remove
set value when where yield
上下文关键字(在查询中使用)
ascending by descending equals from
group in into join let
on orderby select where
华夏公益教科书