Skip to content

Commit f153175

Browse files
committed
Add note for the purpose of input parameters
Fixes dotnet#845. I'm not at all convinced of the tone or precision of this - it's effectively a straw man for further discussion.
1 parent 1b8e8c3 commit f153175

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

standard/classes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,6 +2156,8 @@ Input parameters are not allowed on functions declared as an iterator ([§15.14]
21562156
21572157
In a method that takes input parameters, it is possible for multiple names to represent the same storage location.
21582158
2159+
> *Note*: The primary purpose of input parameters is for efficiency. When the type of a method parameter is a large struct (in terms of memory requirements), it is useful to be able to avoid copying the whole value of the argument when calling the method. Input parameters allow methods to refer to existing values in memory, while providing protection against unwanted changes to those values. *end note*
2160+
21592161
#### 15.6.2.4 Reference parameters
21602162
21612163
A parameter declared with a `ref` modifier is a reference parameter. A reference parameter is a local reference variable ([§9.7](variables.md#97-reference-variables-and-returns)) that gets its initial referent from the corresponding argument supplied in the method invocation.

0 commit comments

Comments
 (0)