@@ -16,7 +16,7 @@ C# defines seven categories of variables: static variables, instance variables,
16
16
17
17
> * Example* : In the following code
18
18
>
19
- > <!-- Example: {template:"standalone-lib", name:"VariableCategories", ignoredWarnings:["CS0169","CS0219","CS0649"]} -->
19
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"VariableCategories", ignoredWarnings:["CS0169","CS0219","CS0649"]} -->
20
20
> ``` csharp
21
21
> class A
22
22
> {
@@ -137,7 +137,7 @@ A local variable introduced by a *local_variable_declaration* is not automatical
137
137
138
138
> *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 :
139
139
>
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 "]} -->
141
141
> ```csharp
142
142
> goto L ;
143
143
>
@@ -435,7 +435,7 @@ finally «finally_block»
435
435
436
436
> *Example *: The following example demonstrates how the different blocks of a `try ` statement ([§12.11](statements .md #1211-the -try -statement )) affect definite assignment .
437
437
>
438
- > <!-- Example : {template :"standalone -lib ", name :"TryCatchFinally ", expectedWarnings :["CS0162 "], ignoredWarnings :["CS0219 "]} -->
438
+ > <!-- Example : {template :"standalone -lib - without - using ", name :"TryCatchFinally ", expectedWarnings :["CS0162 "], ignoredWarnings :["CS0219 "]} -->
439
439
> ```csharp
440
440
> class A
441
441
> {
@@ -527,7 +527,7 @@ For a constant expression with value `true`:
527
527
528
528
> * Example* :
529
529
>
530
- > <!-- IncompleteExample : {template:"standalone-console", name:"ConstantExpressions1", expectedWarnings:["CS0162]} -->
530
+ > <!-- Example : {template:"standalone-console", name:"ConstantExpressions1", expectedWarnings:["CS0162" ]} -->
531
531
> ``` csharp
532
532
> int x ;
533
533
> if (true ) {}
@@ -546,7 +546,7 @@ For a constant expression with value `false`:
546
546
547
547
> *Example *:
548
548
>
549
- > < ! -- IncompleteExample : {template : " standalone-console" , name : " ConstantExpressions2" , expectedWarnings : [" CS0162" ]} -- >
549
+ > < ! -- Example : {template : " standalone-console" , name : " ConstantExpressions2" , expectedWarnings : [" CS0162" ]} -- >
550
550
> ```csharp
551
551
> int x ;
552
552
> if (false )
@@ -617,7 +617,7 @@ For an expression *expr* of the form:
617
617
618
618
> *Example*: In the following code
619
619
>
620
- > <!-- Example : {template :"standalone -lib ", name :"SimpleAssignment "} -->
620
+ > <!-- Example : {template :"standalone -lib - without - using ", name :"SimpleAssignment "} -->
621
621
> ```csharp
622
622
> class A
623
623
> {
@@ -652,7 +652,7 @@ For an expression *expr* of the form:
652
652
653
653
> * Example* : In the following code
654
654
>
655
- > <!-- Example: {template:"standalone-lib", name:"AndAnd"} -->
655
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"AndAnd"} -->
656
656
> ``` csharp
657
657
> class A
658
658
> {
@@ -695,7 +695,7 @@ For an expression *expr* of the form:
695
695
696
696
> * Example* : In the following code
697
697
>
698
- > <!-- Example: {template:"standalone-lib", name:"OrOr"} -->
698
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"OrOr"} -->
699
699
> ``` csharp
700
700
> class A
701
701
> {
@@ -775,8 +775,8 @@ For a *lambda_expression* or *anonymous_method_expression* *expr* with a body (e
775
775
776
776
> * Example* : The example
777
777
>
778
+ > <!-- Example: {template:"standalone-lib-without-using", name:"AnonymousFunctions1", replaceEllipsis:true, expectedErrors:["CS0165"]} -->
778
779
> ``` csharp
779
- > < ! -- Example : {template : " standalone-lib" , name : " AnonymousFunctions1" , replaceEllipsis : true , expectedErrors : [" CS0165" ]} -- >
780
780
> class A
781
781
> {
782
782
> delegate bool Filter (int i );
@@ -800,7 +800,7 @@ For a *lambda_expression* or *anonymous_method_expression* *expr* with a body (e
800
800
<!-- markdownlint -enable MD028 -->
801
801
> *Example *: The example
802
802
>
803
- > < ! -- IncompleteExample : {template : " standalone-lib" , name : " AnonymousFunctions2" , replaceEllipsis : true , expectedErrors : [" CS0165" ]} -- >
803
+ > < ! -- Example : {template : " standalone-lib" , name : " AnonymousFunctions2" , expectedErrors : [" CS0165" ]} -- >
804
804
> ```csharp
805
805
> class A
806
806
> {
@@ -843,6 +843,7 @@ Delegate conversions have a control flow path to the local function body. Captur
843
843
<!-- markdownlint-enable MD028 -->
844
844
> *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 `.
845
845
>
846
+ > <!-- Example : {template : " code-in-class-lib" , name : " RulesForVarsInLocalFunctions" , expectedErrors : [" CS0165" ]} -- >
846
847
> ```csharp
847
848
> void M ()
848
849
> {
0 commit comments