Skip to content

Commit 76e98ea

Browse files
authored
revise example metadata (#716)
1 parent a0e44c5 commit 76e98ea

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

standard/variables.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ C# defines seven categories of variables: static variables, instance variables,
1616

1717
> *Example*: In the following code
1818
>
19-
> <!-- Example: {template:"standalone-lib", name:"VariableCategories", ignoredWarnings:["CS0169","CS0219","CS0649"]} -->
19+
> <!-- Example: {template:"standalone-lib-without-using", name:"VariableCategories", ignoredWarnings:["CS0169","CS0219","CS0649"]} -->
2020
> ```csharp
2121
> class A
2222
> {
@@ -137,7 +137,7 @@ A local variable introduced by a *local_variable_declaration* is not automatical
137137
138138
> *Note*: A *local_variable_declaration* that includes a *local_variable_initializer* is still initially unassigned. Execution of the declaration behaves exactly like an assignment to the variable ([§9.4.4.5](variables.md#9445-declaration-statements)). It is possible to use a variable without executing its *local_variable_initializer*; e.g., within the initializer expression itself or by using a *goto_statement* to bypass the initialization:
139139
>
140-
> <!-- Example: {template:"code-in-main", name:"LocalVariables", expectedErrors:["CS0165"], expectedWarnings:["CS0162"]} -->
140+
> <!-- Example: {template:"code-in-main-without-using", name:"LocalVariables", expectedErrors:["CS0165"], expectedWarnings:["CS0162"]} -->
141141
> ```csharp
142142
> goto L;
143143
>
@@ -435,7 +435,7 @@ finally «finally_block»
435435
436436
> *Example*: The following example demonstrates how the different blocks of a `try` statement ([§12.11](statements.md#1211-the-try-statement)) affect definite assignment.
437437
>
438-
> <!-- Example: {template:"standalone-lib", name:"TryCatchFinally", expectedWarnings:["CS0162"], ignoredWarnings:["CS0219"]} -->
438+
> <!-- Example: {template:"standalone-lib-without-using", name:"TryCatchFinally", expectedWarnings:["CS0162"], ignoredWarnings:["CS0219"]} -->
439439
> ```csharp
440440
> class A
441441
> {
@@ -527,7 +527,7 @@ For a constant expression with value `true`:
527527

528528
> *Example*:
529529
>
530-
> <!-- IncompleteExample: {template:"standalone-console", name:"ConstantExpressions1", expectedWarnings:["CS0162]} -->
530+
> <!-- Example: {template:"standalone-console", name:"ConstantExpressions1", expectedWarnings:["CS0162"]} -->
531531
> ```csharp
532532
> int x;
533533
> if (true) {}
@@ -546,7 +546,7 @@ For a constant expression with value `false`:
546546
547547
> *Example*:
548548
>
549-
> <!-- IncompleteExample: {template:"standalone-console", name:"ConstantExpressions2", expectedWarnings:["CS0162"]} -->
549+
> <!-- Example: {template:"standalone-console", name:"ConstantExpressions2", expectedWarnings:["CS0162"]} -->
550550
> ```csharp
551551
> int x;
552552
> if (false)
@@ -617,7 +617,7 @@ For an expression *expr* of the form:
617617

618618
> *Example*: In the following code
619619
>
620-
> <!-- Example: {template:"standalone-lib", name:"SimpleAssignment"} -->
620+
> <!-- Example: {template:"standalone-lib-without-using", name:"SimpleAssignment"} -->
621621
> ```csharp
622622
> class A
623623
> {
@@ -652,7 +652,7 @@ For an expression *expr* of the form:
652652

653653
> *Example*: In the following code
654654
>
655-
> <!-- Example: {template:"standalone-lib", name:"AndAnd"} -->
655+
> <!-- Example: {template:"standalone-lib-without-using", name:"AndAnd"} -->
656656
> ```csharp
657657
> class A
658658
> {
@@ -695,7 +695,7 @@ For an expression *expr* of the form:
695695

696696
> *Example*: In the following code
697697
>
698-
> <!-- Example: {template:"standalone-lib", name:"OrOr"} -->
698+
> <!-- Example: {template:"standalone-lib-without-using", name:"OrOr"} -->
699699
> ```csharp
700700
> class A
701701
> {
@@ -775,8 +775,8 @@ For a *lambda_expression* or *anonymous_method_expression* *expr* with a body (e
775775

776776
> *Example*: The example
777777
>
778+
> <!-- Example: {template:"standalone-lib-without-using", name:"AnonymousFunctions1", replaceEllipsis:true, expectedErrors:["CS0165"]} -->
778779
> ```csharp
779-
> <!-- Example: {template:"standalone-lib", name:"AnonymousFunctions1", replaceEllipsis:true, expectedErrors:["CS0165"]} -->
780780
> class A
781781
> {
782782
> delegate bool Filter(int i);
@@ -800,7 +800,7 @@ For a *lambda_expression* or *anonymous_method_expression* *expr* with a body (e
800800
<!-- markdownlint-enable MD028 -->
801801
> *Example*: The example
802802
>
803-
> <!-- IncompleteExample: {template:"standalone-lib", name:"AnonymousFunctions2", replaceEllipsis:true, expectedErrors:["CS0165"]} -->
803+
> <!-- Example: {template:"standalone-lib", name:"AnonymousFunctions2", expectedErrors:["CS0165"]} -->
804804
> ```csharp
805805
> class A
806806
> {
@@ -843,6 +843,7 @@ Delegate conversions have a control flow path to the local function body. Captur
843843
<!-- markdownlint-enable MD028 -->
844844
> *Example*: The following example demonstrates definite assignment for captured variables in local functions. If a local function reads a captured variable before writing it, the captured variable must be definitely assigned before calling the local function. The local function `F1` reads `s` without assigning it. It is an error if `F1` is called before `s` is definitely assigned. `F2` assigns `i` before reading it. It may be called before `i` is definitely assigned. Furthermore, `F3` may be called after `F2` because `s2` is definitely assigned in `F2`.
845845
>
846+
> <!-- Example: {template:"code-in-class-lib", name:"RulesForVarsInLocalFunctions", expectedErrors:["CS0165"]} -->
846847
> ```csharp
847848
> void M()
848849
> {

0 commit comments

Comments
 (0)