You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/csharp/tutorials/exploration/csharp-7.yml
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -121,7 +121,7 @@ when inspecting the tuple using reflection at runtime, for example.
121
121
122
122
The examples above show the basic syntax to declare tuples. Tuples are
123
123
most useful as return types for `private` and `internal` methods. Tuples
124
-
provide a simple syntax for those methods to return multiple discrete values.
124
+
provide a simple syntax for those methods to return multiple discrete values:
125
125
You save the work of authoring a `class` or a `struct` that
126
126
defines the type returned. There is no need to create a new type.
127
127
@@ -140,13 +140,13 @@ when inspecting the tuple using reflection at runtime, for example.
140
140
141
141
The declaration for the method provides the names for the fields of the
142
142
tuple that is returned. When you call the method, the return value is a
143
-
tuple whose fields are `Max` and `Min`.
143
+
tuple whose fields are `Max` and `Min`:
144
144
145
145
[!code-csharp[CallingTupleMethod](~/samples/snippets/csharp/new-in-7/program.cs#09_CallingTupleMethod "Calling a tuple returning method")]
146
146
147
147
There may be times when you want to unpackage the members of a tuple that
148
148
were returned from a method. You can do that by declaring separate variables
149
-
for each of the values in the tuple. This is called *deconstructing* the tuple.
149
+
for each of the values in the tuple. This is called *deconstructing* the tuple:
150
150
151
151
[!code-csharp[CallingWithDeconstructor](~/samples/snippets/csharp/new-in-7/program.cs#10_CallingWithDeconstructor "Deconstructing a tuple")]
152
152
@@ -155,11 +155,11 @@ when inspecting the tuple using reflection at runtime, for example.
155
155
`Deconstruct`method provides a set of `out` arguments for each of the
156
156
properties you want to extract. Consider
157
157
this `Point` class that provides a deconstructor method that extracts
158
-
the `X` and `Y` coordinates.
158
+
the `X` and `Y` coordinates:
159
159
160
160
[!code-csharp[PointWithDeconstruction](~/samples/snippets/csharp/new-in-7/point.cs#11_PointWithDeconstruction "Point with deconstruction method")]
161
161
162
-
You can extract the individual fields by assigning a `Point` to a tuple.
162
+
You can extract the individual fields by assigning a `Point` to a tuple:
163
163
164
164
[!code-csharp[DeconstructPoint](~/samples/snippets/csharp/new-in-7/program.cs#12_DeconstructPoint "Deconstruct a point")]
165
165
@@ -176,7 +176,7 @@ when inspecting the tuple using reflection at runtime, for example.
176
176
content: |
177
177
Often when deconstructing a tuple or calling a method with `out` parameters, you're forced to define a variable whose value you don't care about and don't intend to use. C# adds support for *discards* to handle this scenario. A discard is a write-only variable whose name is `_` (the underscore character); you can assign all of the values that you intend to discard to the single variable. A discard is like an unassigned variable; apart from the assignment, the discard can't be used in code.
178
178
179
-
Discards are supported in the following scenarios.
179
+
Discards are supported in the following scenarios:
180
180
181
181
* When deconstructing tuples or user-defined types.
0 commit comments