Skip to content

Commit e6f7bbf

Browse files
committed
but wait, there's more.
1 parent 3e9769e commit e6f7bbf

14 files changed

+61
-67
lines changed

docs/csharp/language-reference/builtin-types/bool.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The default value of the `bool` type is `false`.
2626

2727
You can use the `true` and `false` literals to initialize a `bool` variable or to pass a `bool` value:
2828

29-
[!code-csharp-interactive[bool literals](snippets/shared/BoolType.cs#Literals)]
29+
[!code-csharp[bool literals](snippets/shared/BoolType.cs#Literals)]
3030

3131
## Three-valued Boolean logic
3232

docs/csharp/language-reference/builtin-types/nullable-value-types.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The default value of a nullable value type represents `null`, that is, it's an i
2525

2626
You can use the [`is` operator with a type pattern](../operators/type-testing-and-cast.md#type-testing-with-pattern-matching) to both examine an instance of a nullable value type for `null` and retrieve a value of an underlying type:
2727

28-
[!code-csharp-interactive[use pattern matching](snippets/shared/NullableValueTypes.cs#PatternMatching)]
28+
[!code-csharp[use pattern matching](snippets/shared/NullableValueTypes.cs#PatternMatching)]
2929

3030
You always can use the following read-only properties to examine and get a value of a nullable value type variable:
3131

@@ -35,17 +35,17 @@ You always can use the following read-only properties to examine and get a value
3535

3636
The following example uses the `HasValue` property to test whether the variable contains a value before displaying it:
3737

38-
[!code-csharp-interactive[use HasValue](snippets/shared/NullableValueTypes.cs#HasValue)]
38+
[!code-csharp[use HasValue](snippets/shared/NullableValueTypes.cs#HasValue)]
3939

4040
You can also compare a variable of a nullable value type with `null` instead of using the `HasValue` property, as the following example shows:
4141

42-
[!code-csharp-interactive[use comparison with null](snippets/shared/NullableValueTypes.cs#CompareWithNull)]
42+
[!code-csharp[use comparison with null](snippets/shared/NullableValueTypes.cs#CompareWithNull)]
4343

4444
## Conversion from a nullable value type to an underlying type
4545

4646
If you want to assign a value of a nullable value type to a non-nullable value type variable, you might need to specify the value to be assigned in place of `null`. Use the [null-coalescing operator `??`](../operators/null-coalescing-operator.md) to do that (you can also use the <xref:System.Nullable%601.GetValueOrDefault(%600)?displayProperty=nameWithType> method for the same purpose):
4747

48-
[!code-csharp-interactive[?? operator](snippets/shared/NullableValueTypes.cs#NullCoalescing)]
48+
[!code-csharp[?? operator](snippets/shared/NullableValueTypes.cs#NullCoalescing)]
4949

5050
If you want to use the [default](default-values.md) value of the underlying value type in place of `null`, use the <xref:System.Nullable%601.GetValueOrDefault?displayProperty=nameWithType> method.
5151

@@ -71,7 +71,7 @@ For the [comparison operators](../operators/comparison-operators.md) `<`, `>`, `
7171
- neither greater than or equal to `null`
7272
- nor less than `null`
7373

74-
[!code-csharp-interactive[relational and equality operators](snippets/shared/NullableValueTypes.cs#ComparisonOperators)]
74+
[!code-csharp[relational and equality operators](snippets/shared/NullableValueTypes.cs#ComparisonOperators)]
7575

7676
For the [equality operator](../operators/equality-operators.md#equality-operator-) `==`, if both operands are `null`, the result is `true`, if only one of the operands is `null`, the result is `false`; otherwise, the contained values of operands are compared.
7777

@@ -88,23 +88,23 @@ An instance of a nullable value type `T?` is [boxed](../../programming-guide/typ
8888

8989
You can unbox a boxed value of a value type `T` to the corresponding nullable value type `T?`, as the following example shows:
9090

91-
[!code-csharp-interactive[boxing and unboxing](snippets/shared/NullableValueTypes.cs#Boxing)]
91+
[!code-csharp[boxing and unboxing](snippets/shared/NullableValueTypes.cs#Boxing)]
9292

9393
## How to identify a nullable value type
9494

9595
The following example shows how to determine whether a <xref:System.Type?displayProperty=nameWithType> instance represents a constructed nullable value type, that is, the <xref:System.Nullable%601?displayProperty=nameWithType> type with a specified type parameter `T`:
9696

97-
[!code-csharp-interactive[whether Type is nullable](snippets/shared/NullableValueTypes.cs#IsTypeNullable)]
97+
[!code-csharp[whether Type is nullable](snippets/shared/NullableValueTypes.cs#IsTypeNullable)]
9898

9999
As the example shows, you use the [typeof](../operators/type-testing-and-cast.md#the-typeof-operator) operator to create a <xref:System.Type?displayProperty=nameWithType> instance.
100100

101101
If you want to determine whether an instance is of a nullable value type, don't use the <xref:System.Object.GetType%2A?displayProperty=nameWithType> method to get a <xref:System.Type> instance to be tested with the preceding code. When you call the <xref:System.Object.GetType%2A?displayProperty=nameWithType> method on an instance of a nullable value type, the instance is [boxed](#boxing-and-unboxing) to <xref:System.Object>. As boxing of a non-null instance of a nullable value type is equivalent to boxing of a value of the underlying type, <xref:System.Object.GetType%2A> returns a <xref:System.Type> instance that represents the underlying type of a nullable value type:
102102

103-
[!code-csharp-interactive[GetType example](snippets/shared/NullableValueTypes.cs#GetType)]
103+
[!code-csharp[GetType example](snippets/shared/NullableValueTypes.cs#GetType)]
104104

105105
Also, don't use the [is](../operators/type-testing-and-cast.md#the-is-operator) operator to determine whether an instance is of a nullable value type. As the following example shows, you cannot distinguish types of a nullable value type instance and its underlying type instance with the `is` operator:
106106

107-
[!code-csharp-interactive[is operator example](snippets/shared/NullableValueTypes.cs#IsOperator)]
107+
[!code-csharp[is operator example](snippets/shared/NullableValueTypes.cs#IsOperator)]
108108

109109
Instead use the <xref:System.Nullable.GetUnderlyingType%2A?displayProperty=nameWithType> from the first example and [typeof](../operators/type-testing-and-cast.md#the-typeof-operator) operator to check if an instance is of a nullable value type.
110110

docs/csharp/language-reference/builtin-types/value-tuples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Typically, you use tuples to group loosely related data elements. In public APIs
3939

4040
You explicitly specify tuple fields names in a tuple initialization expression or in the definition of a tuple type, as the following example shows:
4141

42-
[!code-csharp-interactive[explicit field names](snippets/shared/ValueTuples.cs#ExplicitFieldNames)]
42+
[!code-csharp[explicit field names](snippets/shared/ValueTuples.cs#ExplicitFieldNames)]
4343

4444
If you don't specify a field name, it may be inferred from the name of the corresponding variable in a tuple initialization expression, as the following example shows:
4545

docs/csharp/language-reference/operators/comparison-operators.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,25 @@ The [`==` and `!=` operators](equality-operators.md) check if their operands are
3737

3838
The `<` operator returns `true` if its left-hand operand is less than its right-hand operand, `false` otherwise:
3939

40-
[!code-csharp-interactive[less than example](snippets/shared/ComparisonOperators.cs#Less)]
40+
[!code-csharp[less than example](snippets/shared/ComparisonOperators.cs#Less)]
4141

4242
## Greater than operator >
4343

4444
The `>` operator returns `true` if its left-hand operand is greater than its right-hand operand, `false` otherwise:
4545

46-
[!code-csharp-interactive[greater than example](snippets/shared/ComparisonOperators.cs#Greater)]
46+
[!code-csharp[greater than example](snippets/shared/ComparisonOperators.cs#Greater)]
4747

4848
## Less than or equal operator \<=
4949

5050
The `<=` operator returns `true` if its left-hand operand is less than or equal to its right-hand operand, `false` otherwise:
5151

52-
[!code-csharp-interactive[less than or equal example](snippets/shared/ComparisonOperators.cs#LessOrEqual)]
52+
[!code-csharp[less than or equal example](snippets/shared/ComparisonOperators.cs#LessOrEqual)]
5353

5454
## Greater than or equal operator >=
5555

5656
The `>=` operator returns `true` if its left-hand operand is greater than or equal to its right-hand operand, `false` otherwise:
5757

58-
[!code-csharp-interactive[greater than or equal example](snippets/shared/ComparisonOperators.cs#GreaterOrEqual)]
58+
[!code-csharp[greater than or equal example](snippets/shared/ComparisonOperators.cs#GreaterOrEqual)]
5959

6060
## Operator overloadability
6161

docs/csharp/language-reference/operators/default.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ You also use the `default` keyword as the default case label within a [`switch`
1717

1818
The argument to the `default` operator must be the name of a type or a type parameter, as the following example shows:
1919

20-
[!code-csharp-interactive[default of T](snippets/shared/DefaultOperator.cs#WithOperand)]
20+
[!code-csharp[default of T](snippets/shared/DefaultOperator.cs#WithOperand)]
2121

2222
## default literal
2323

@@ -30,7 +30,7 @@ You can use the `default` literal to produce the default value of a type when th
3030

3131
The following example shows the usage of the `default` literal:
3232

33-
[!code-csharp-interactive[default literal](snippets/shared/DefaultOperator.cs#DefaultLiteral)]
33+
[!code-csharp[default literal](snippets/shared/DefaultOperator.cs#DefaultLiteral)]
3434

3535
> [!TIP]
3636
> Use .NET style rule [IDE0034](../../../fundamentals/code-analysis/style-rules/ide0034.md) to specify a preference on the use of the `default` literal in your codebase.

docs/csharp/language-reference/operators/delegate-operator.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ helpviewer_keywords:
1010

1111
The `delegate` operator creates an anonymous method that can be converted to a delegate type. An anonymous method can be converted to types such as <xref:System.Action?displayProperty=nameWithType> and <xref:System.Func%601?displayProperty=nameWithType> types used as arguments to many methods.
1212

13-
[!code-csharp-interactive[anonymous method](snippets/shared/DelegateOperator.cs#AnonymousMethod)]
13+
[!code-csharp[anonymous method](snippets/shared/DelegateOperator.cs#AnonymousMethod)]
1414

1515
> [!NOTE]
1616
> Lambda expressions provide a more concise and expressive way to create an anonymous function. Use the [=> operator](lambda-operator.md) to construct a lambda expression:
1717
>
18-
> [!code-csharp-interactive[lambda expression](snippets/shared/DelegateOperator.cs#Lambda)]
18+
> [!code-csharp[lambda expression](snippets/shared/DelegateOperator.cs#Lambda)]
1919
>
2020
> For more information about features of lambda expressions, for example, capturing outer variables, see [Lambda expressions](lambda-expressions.md).
2121
2222
When you use the `delegate` operator, you might omit the parameter list. If you do that, the created anonymous method can be converted to a delegate type with any list of parameters, as the following example shows:
2323

24-
[!code-csharp-interactive[no parameter list](snippets/shared/DelegateOperator.cs#WithoutParameterList)]
24+
[!code-csharp[no parameter list](snippets/shared/DelegateOperator.cs#WithoutParameterList)]
2525

2626
That's the only functionality of anonymous methods not supported by lambda expressions. In all other cases, a lambda expression is a preferred way to write inline code. You can use [discards](../../fundamentals/functional/discards.md) to specify two or more input parameters of an anonymous method that aren't used by the method:
2727

docs/csharp/language-reference/operators/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ Here are some other kinds of expressions that C# provides:
3838

3939
- [Interpolated string expressions](../tokens/interpolated.md) that provide convenient syntax to create formatted strings:
4040

41-
[!code-csharp-interactive[interpolated string](snippets/shared/Overview.cs#InterpolatedString)]
41+
[!code-csharp[interpolated string](snippets/shared/Overview.cs#InterpolatedString)]
4242

4343
- [Lambda expressions](lambda-expressions.md) that allow you to create anonymous functions:
4444

45-
[!code-csharp-interactive[lambda expression](snippets/shared/Overview.cs#Lambda)]
45+
[!code-csharp[lambda expression](snippets/shared/Overview.cs#Lambda)]
4646

4747
- [Query expressions](../keywords/query-keywords.md) that allow you to use query capabilities directly in C#:
4848

49-
[!code-csharp-interactive[query expression](snippets/shared/Overview.cs#Query)]
49+
[!code-csharp[query expression](snippets/shared/Overview.cs#Query)]
5050

5151
You can use an [expression body definition](../../programming-guide/statements-expressions-operators/expression-bodied-members.md) to provide a concise definition for a method, constructor, property, indexer, or finalizer.
5252

docs/csharp/language-reference/operators/new-operator.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ The `new` operator creates a new instance of a type. You can also use the `new`
1616

1717
To create a new instance of a type, you typically invoke one of the [constructors](../../programming-guide/classes-and-structs/constructors.md) of that type using the `new` operator:
1818

19-
[!code-csharp-interactive[invoke constructor](snippets/shared/NewOperator.cs#Constructor)]
19+
[!code-csharp[invoke constructor](snippets/shared/NewOperator.cs#Constructor)]
2020

2121
You can use an [object or collection initializer](../../programming-guide/classes-and-structs/object-and-collection-initializers.md) with the `new` operator to instantiate and initialize an object in one statement, as the following example shows:
2222

23-
[!code-csharp-interactive[constructor with initializer](snippets/shared/NewOperator.cs#ConstructorWithInitializer)]
23+
[!code-csharp[constructor with initializer](snippets/shared/NewOperator.cs#ConstructorWithInitializer)]
2424

2525
### Target-typed `new`
2626

@@ -36,19 +36,19 @@ If a target type of a `new` expression is unknown (for example, when you use the
3636

3737
You also use the `new` operator to create an array instance, as the following example shows:
3838

39-
[!code-csharp-interactive[create array](snippets/shared/NewOperator.cs#Array)]
39+
[!code-csharp[create array](snippets/shared/NewOperator.cs#Array)]
4040

4141
Use array initialization syntax to create an array instance and populate it with elements in one statement. The following example shows various ways how you can do that:
4242

43-
[!code-csharp-interactive[initialize array](snippets/shared/NewOperator.cs#ArrayInitialization)]
43+
[!code-csharp[initialize array](snippets/shared/NewOperator.cs#ArrayInitialization)]
4444

4545
For more information about arrays, see [Arrays](../builtin-types/arrays.md).
4646

4747
## Instantiation of anonymous types
4848

4949
To create an instance of an [anonymous type](../../fundamentals/types/anonymous-types.md), use the `new` operator and object initializer syntax:
5050

51-
[!code-csharp-interactive[anonymous type](snippets/shared/NewOperator.cs#AnonymousType)]
51+
[!code-csharp[anonymous type](snippets/shared/NewOperator.cs#AnonymousType)]
5252

5353
## Destruction of type instances
5454

0 commit comments

Comments
 (0)