Code fix for CS0206 when passing a property to a ref parameter #51515
Labels
Area-IDE
Concept-Continuous Improvement
Feature Request
help wanted
The issue is "up for grabs" - add a comment if you are interested in working on it
IDE-CodeStyle
Built-in analyzers, fixes, and refactorings
Milestone
This is similar to #51512 and could also be linked from the big table in #23326 under CS0206, and CS1510 for the last example.
It would save me time if there was a light bulb fix
💡 Pass and update 'Property' using a temporary variable
:out
parameters💡 Update 'Property' using a temporary variable
:Struct properties
#51512 comes into play and ideally these two concepts would work together.
💡 Copy and set updated 'StructProperty' value
(message from #51512):With an
out
parameter:💡 Copy and set updated 'StructProperty' value
(message from #51512):Non-lvalues (CS1510)
@RikkiGibson suggested that this could be extended to provide a fix for passing a ref to a non-lvalue for a different error code, CS1510:
💡 Pass '2 + 2' using a temporary variable
(stripping the parens in the message):The text was updated successfully, but these errors were encountered: