You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/csharp/language-reference/operators/default.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,19 +7,19 @@ f1_keywords:
7
7
helpviewer_keywords:
8
8
- "default keyword [C#]"
9
9
---
10
-
# default value expressions - produce the default value
10
+
# Default value expressions - produce the default value
11
11
12
-
A default value expression produces the [default value](../builtin-types/default-values.md) of a type. There are two kinds of default value expressions: the [default operator](#default-operator) call and a [default literal](#default-literal).
12
+
A default value expression produces the [default value](../builtin-types/default-values.md) of a type. There are two kinds of default value expressions: the [`default` operator](#default-operator) call and a [`default` literal](#default-literal).
13
13
14
14
You also use the `default` keyword as the default case label within a [`switch` statement](../statements/selection-statements.md#the-switch-statement).
15
15
16
-
## default operator
16
+
## `default` operator
17
17
18
18
The argument to the `default` operator must be the name of a type or a type parameter, as the following example shows:
19
19
20
20
[!code-csharp[default of T](snippets/shared/DefaultOperator.cs#WithOperand)]
21
21
22
-
## default literal
22
+
## `default` literal
23
23
24
24
You can use the `default` literal to produce the default value of a type when the compiler can infer the expression type. The `default` literal expression produces the same value as the `default(T)` expression where `T` is the inferred type. You can use the `default` literal in any of the following cases:
Copy file name to clipboardExpand all lines: samples/snippets/core/testing/unit-testing-using-nunit/csharp/PrimeService.Tests/PrimeService.Tests.csproj
0 commit comments