Open
Description
This example makes no sense to me without the in keyword it is also still 44. The in keyword seems only usefull to state that the argument cannot be changed within the scope of the method.
int readonlyArgument = 44;
InArgExample(readonlyArgument);
Console.WriteLine(readonlyArgument); // value is still 44
private static void InArgExample(in int number)
{
// Uncomment the following line to see error CS8331
// number = 19;
}
[Enter feedback here]
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 6b1434b0-5459-7569-47f7-46bf33fc3953
- Version Independent ID: 8a4ae81b-1ae5-cbe6-d58b-df455414e245
- Content: in parameter modifier - C# Reference
- Content Source: docs/csharp/language-reference/keywords/in-parameter-modifier.md
- Product: dotnet-csharp
- Technology: csharp-language-reference
- GitHub Login: @BillWagner
- Microsoft Alias: wiwagn
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
🏗 In progress