@@ -138,7 +138,7 @@ A variable of a struct type directly contains the data of the struct, whereas a
138
138
139
139
> *Example*:
140
140
>
141
- > <!-- Example: {template:"standalone-lib", name:"ValueSemantics1", expectedErrors:["CS0523"], ignoredWarnings:["CS0169"]} -->
141
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"ValueSemantics1", expectedErrors:["CS0523"], ignoredWarnings:["CS0169"]} -->
142
142
> ```csharp
143
143
> struct Node
144
144
> {
@@ -149,7 +149,7 @@ A variable of a struct type directly contains the data of the struct, whereas a
149
149
>
150
150
> is an error because `Node` contains an instance field of its own type. Another example
151
151
>
152
- > <!-- Example: {template:"standalone-lib", name:"ValueSemantics2", expectedErrors:["CS0523","CS0523","CS0523"], ignoredWarnings:["CS0169"]} -->
152
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"ValueSemantics2", expectedErrors:["CS0523","CS0523","CS0523"], ignoredWarnings:["CS0169"]} -->
153
153
> ```csharp
154
154
> struct A { B b; }
155
155
> struct B { C c; }
@@ -188,7 +188,7 @@ With classes, it is possible for two variables to reference the same object, and
188
188
> Point a = new Point(10, 10);
189
189
> Point b = a;
190
190
> a.x = 100;
191
- > System. Console.WriteLine(b.x);
191
+ > Console.WriteLine(b.x);
192
192
> }
193
193
> }
194
194
> ```
@@ -221,7 +221,7 @@ As described in [§9.3](variables.md#93-default-values), several kinds of variab
221
221
222
222
> *Example*: Referring to the `Point` struct declared above, the example
223
223
>
224
- > <!-- IncompleteExample : {template:"standalone-lib ", name:"DefaultValues1", expectedErrors :["x","x"], expectedWarnings:["x","x "]} -->
224
+ > <!-- Example : {template:"code-in-main-without-using ", name:"DefaultValues1", additionalFiles :["Point.cs "]} -->
225
225
> ```csharp
226
226
> Point[] a = new Point[100];
227
227
> ```
@@ -236,7 +236,6 @@ The default value of a struct corresponds to the value returned by the default c
236
236
>
237
237
> <!-- Example: {template:"standalone-lib", name:"DefaultValues2", ignoredWarnings:["CS0649"]} -->
238
238
> ```csharp
239
- > using System;
240
239
> struct KeyValuePair
241
240
> {
242
241
> string key;
@@ -277,7 +276,6 @@ The meaning of `this` in a struct differs from the meaning of `this` in a class,
277
276
>
278
277
> <!-- Example: {template:"standalone-console", name:"MeaningOfThis1", inferOutput:true} -->
279
278
> ```csharp
280
- > using System;
281
279
> struct Counter
282
280
> {
283
281
> int value;
@@ -320,8 +318,6 @@ Similarly, boxing never implicitly occurs when accessing a member on a constrain
320
318
>
321
319
> <!-- Example: {template:"standalone-console", name:"MeaningOfThis2", inferOutput:true} -->
322
320
> ```csharp
323
- > using System;
324
- >
325
321
> interface ICounter
326
322
> {
327
323
> void Increment();
@@ -368,7 +364,7 @@ As described in [§15.4.5](structs.md#1545-default-values), the default value of
368
364
369
365
> *Example*: The following
370
366
>
371
- > <!-- Example: {template:"standalone-lib", name:"FieldInitializers", expectedErrors:["CS8983"], ignoredWarnings:["CS0649"]} -->
367
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"FieldInitializers", expectedErrors:["CS8983"], ignoredWarnings:["CS0649"]} -->
372
368
> ```csharp
373
369
> struct Point
374
370
> {
@@ -387,7 +383,7 @@ Unlike a class, a struct is not permitted to declare a parameterless instance co
387
383
388
384
> *Example*: Given the following
389
385
>
390
- > <!-- Example: {template:"standalone-console", name:"Constructors1", ignoredWarnings:["CS0219"]} -->
386
+ > <!-- Example: {template:"standalone-console-without-using ", name:"Constructors1", ignoredWarnings:["CS0219"]} -->
391
387
> ```csharp
392
388
> struct Point
393
389
> {
@@ -422,7 +418,7 @@ If the struct instance constructor specifies a constructor initializer, that ini
422
418
423
419
> *Example*: Consider the instance constructor implementation below:
424
420
>
425
- > <!-- Example: {template:"standalone-lib", name:"Constructors2", expectedErrors:["CS0188"]} -->
421
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"Constructors2", expectedErrors:["CS0188"]} -->
426
422
> ```csharp
427
423
> struct Point
428
424
> {
@@ -449,7 +445,7 @@ If the struct instance constructor specifies a constructor initializer, that ini
449
445
> No instance function member (including the set accessors for the properties `X` and `Y`) can be called until all fields of the struct being constructed have been definitely assigned. Note, however, that if `Point` were a class instead of a struct, the instance constructor implementation would be permitted.
450
446
> There is one exception to this, and that involves automatically implemented properties ([§14.7.4](classes.md#1474-automatically-implemented-properties)). The definite assignment rules ([§11.19.2](expressions.md#11192-simple-assignment)) specifically exempt assignment to an auto-property of a struct type within an instance constructor of that struct type: such an assignment is considered a definite assignment of the hidden backing field of the auto-property. Thus, the following is allowed:
451
447
>
452
- > <!-- Example: {template:"standalone-lib", name:"Constructors3"} -->
448
+ > <!-- Example: {template:"standalone-lib-without-using ", name:"Constructors3"} -->
453
449
> ```csharp
454
450
> struct Point
455
451
> {
0 commit comments