Skip to content

Commit 2747148

Browse files
CopilotgewarrenCopilot
authored
Fix IDE0360 example: only simplify get accessor, preserve set with validation (#50364)
* Initial plan * Fix IDE0360 documentation example - only simplify get accessor Co-authored-by: gewarren <[email protected]> * Update docs/fundamentals/code-analysis/style-rules/ide0360.md Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: gewarren <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent b200941 commit 2747148

File tree

1 file changed

+5
-1
lines changed
  • docs/fundamentals/code-analysis/style-rules

1 file changed

+5
-1
lines changed

docs/fundamentals/code-analysis/style-rules/ide0360.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ public int Prop
4949
}
5050

5151
// Fixed code.
52-
public int Prop { get; set; }
52+
public int Prop
53+
{
54+
get;
55+
set { field = (value > 0) ? value : throw new ArgumentException(); }
56+
}
5357
```
5458

5559
## Suppress a warning

0 commit comments

Comments
 (0)