Skip to content

Commit ba6f51a

Browse files
Copilotgewarren
andauthored
Rewrite primary constructor rationale in active voice (#50892)
* Initial plan * Rewrite primary constructor rationale in active voice Converted passive voice paragraph to active voice with conversational tone per style guidelines. Uses "you" form and simpler, more direct language. Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
1 parent b515ea7 commit ba6f51a

File tree

1 file changed

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

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dev_langs:
2424

2525
This rule flags classes that can use a [primary constructor](../../../csharp/programming-guide/classes-and-structs/instance-constructors.md#primary-constructors) instead of a separate constructor definition. You define a primary constructor by placing any constructor parameters in parentheses following the type name. A primary constructor indicates that these parameters are necessary for any instance of the type.
2626

27-
The ability of a class or struct in C# to have more than one constructor provides for generality, but at the expense of some tedium in the declaration syntax, because the constructor input and the class state need to be cleanly separated. Primary constructors put the parameters of one constructor in scope for the whole class or struct to be used for initialization or directly as object state. The trade-off is that any other constructors must call through the primary constructor.
27+
When you create a class or struct with multiple constructors, you gain flexibility, but you also add verbose syntax. You must cleanly separate the constructor input from the class state. With primary constructors, you can put one constructor's parameters in scope for the whole class or struct. You can use these parameters for initialization or directly as object state. However, if you add other constructors, they must call through the primary constructor.
2828

2929
## Options
3030

0 commit comments

Comments
 (0)