Using action to " Generate property 'X' " with init; instead of automatic set;

Hello Jetbrains,

Context

As a fan of automatic code generation, I can't find a configurable way to generate properties using Alt+Enter => Create propery ‘…’ context action with init; instead of systematic set;.

Is there a way to configure that ? Otherwise, this would be appriaciated.

Example

Action Create propery ‘Y’ generating property always using  set;:

Generated code:

Moreover, generated code is not compiling when required keyword is necessary… But this could be an other topic :)

Expected behavior, Having property Y genereted like:

Suggestion

Have a way to configure or a suggestion to generate with init; statement instead of automatic set;.

 

Bonus

What's about required keyword introduced in c# 11 ?

 

Regards,

Hugo

1
2 comments

Yep. I also want required and init most of the time. Would be pretty cool if it would follow the pattern if other props already exist.

1

Hello, 

Thanks for contacting JetBrains supports. 

I apologize for not replying earlier. This feature is currently not supported. We have a similar feature request on our issue tracker: RSRP-501137 "Create property x" customization . You may upvote and subscribe for further updates. We will update the issue once there is any progress. 

 

Thanks,

Tom

0

Please sign in to leave a comment.