-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
📌 seQUESTeredIdentifies that an issue has been imported into Quest.Identifies that an issue has been imported into Quest.advanced-concepts/subsvcdotnet-csharp/svcokr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
Description
Omitting the in modifier at the call site informs the compiler that it's allowed to make a copy of the argument for any of the following reasons:
- There exists an implicit conversion but not an identity conversion from the argument type to the parameter type.
- The argument is an expression but doesn't have a known storage variable.
- An overload exists that differs by the presence or absence of in. In that case, the by value overload is a better match.
These rules are useful as you update existing code to use read-only reference arguments. Inside the called method, you can call any instance method that uses by-value parameters. In those instances, a copy of the in parameter is created.
Paragraph “These rules are useful …” likely was about to link just ability to omit in modifier at caller site since rules above are directly linked to caller site characteristic rather than in parameter at callee site.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: ac8804c7-6acd-ab2a-4e14-0b99265969a5
- Version Independent ID: 183efcbd-a781-d303-f9cd-1c22da1676de
- Content: Write safe and efficient C# code
- Content Source: docs/csharp/write-safe-efficient-code.md
- Product: dotnet-csharp
- Technology: csharp-advanced-concepts
- GitHub Login: @BillWagner
- Microsoft Alias: wiwagn
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
📌 seQUESTeredIdentifies that an issue has been imported into Quest.Identifies that an issue has been imported into Quest.advanced-concepts/subsvcdotnet-csharp/svcokr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.