Skip to content

Commit d2e3bcf

Browse files
pkulikovYoussef1313
authored andcommitted
Fix snippet ID for new snippet syntax (#16789)
* Use original snippet syntax * Update docs/csharp/language-reference/builtin-types/value-types.md Co-Authored-By: Youssef Victor <[email protected]> * Updated second snippet entry * Use old syntax Co-authored-by: Youssef Victor <[email protected]>
1 parent 73bcc6d commit d2e3bcf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ ms.assetid: 471eb994-2958-49d5-a6be-19b4313f80a3
1313

1414
*Value types* and [reference types](../keywords/reference-types.md) are the two main categories of C# types. A variable of a value type contains an instance of the type. This differs from a variable of a reference type, which contains a reference to an instance of the type. By default, on [assignment](../operators/assignment-operator.md), passing an argument to a method, or returning a method result, variable values are copied. In the case of value-type variables, the corresponding type instances are copied. The following example demonstrates that behavior:
1515

16-
:::code language="csharp" source="~/samples/csharp/language-reference/builtin-types/ValueTypes.cs" id="ValueTypeCopied":::
16+
[!code-csharp[copy of values](~/samples/csharp/language-reference/builtin-types/ValueTypes.cs#ValueTypeCopied)]
1717

1818
As the preceding example shows, operations on a value-type variable affect only that instance of the value type, stored in the variable.
1919

2020
If a value type contains a data member of a reference type, only the reference to the instance of the reference type is copied when a value-type instance is copied. Both the copy and original value-type instance have access to the same reference-type instance. The following example demonstrates that behavior:
2121

22-
:::code language="csharp" source="~/samples/csharp/language-reference/builtin-types/ValueTypes.cs" id="ShallowCopy":::
22+
[!code-csharp[shallow copy](~/samples/csharp/language-reference/builtin-types/ValueTypes.cs#ShallowCopy)]
2323

2424
> [!NOTE]
2525
> To make your code less error-prone and more robust, define and use immutable value types. This article uses mutable value types only for demonstration purposes.

0 commit comments

Comments
 (0)