Skip to content

Commit

Permalink
Update method-parameters.md anchor problem (dotnet#43200)
Browse files Browse the repository at this point in the history
fix: The anchor's ref-parameter-modifier and ref-readonly-modifier have been swapped.
  • Loading branch information
juner authored Oct 25, 2024
1 parent 09cb0e2 commit 1700510
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/csharp/language-reference/keywords/method-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ Informally, you can think of these scopes as the mechanism to ensure your code n

You apply one of the following modifiers to a parameter declaration to pass arguments by reference instead of by value:

- [`ref`](#ref-readonly-modifier): The argument must be initialized before calling the method. The method can assign a new value to the parameter, but isn't required to do so.
- [`ref`](#ref-parameter-modifier): The argument must be initialized before calling the method. The method can assign a new value to the parameter, but isn't required to do so.
- [`out`](#out-parameter-modifier): The calling method isn't required to initialize the argument before calling the method. The method must assign a value to the parameter.
- [`readonly ref`](#ref-parameter-modifier): The argument must be initialized before calling the method. The method can't assign a new value to the parameter.
- [`readonly ref`](#ref-readonly-modifier): The argument must be initialized before calling the method. The method can't assign a new value to the parameter.
- [`in`](#in-parameter-modifier): The argument must be initialized before calling the method. The method can't assign a new value to the parameter. The compiler might create a temporary variable to hold a copy of the argument to `in` parameters.

Members of a class can't have signatures that differ only by `ref`, `ref readonly`, `in`, or `out`. A compiler error occurs if the only difference between two members of a type is that one of them has a `ref` parameter and the other has an `out`, `ref readonly`, or `in` parameter. However, methods can be overloaded when one method has a `ref`, `ref readonly`, `in`, or `out` parameter and the other has a parameter that is passed by value, as shown in the following example. In other situations that require signature matching, such as hiding or overriding, `in`, `ref`, `ref readonly`, and `out` are part of the signature and don't match each other.
Expand Down

0 comments on commit 1700510

Please sign in to comment.