Feature Request: property declaration & initialization inside constructor #679
Unanswered
v-zmiycharov
asked this question in
General
Replies: 2 comments
-
Look at #39 (records). I believe it would help you in such a case too. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Also https://github.com/dotnet/csharplang/blob/master/proposals/primary-constructors.md |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It would be nice to be able to init properties like in typescript for example:
Currently in C#:
class MyClass { private int x; public MyClass(int x) { this.x = x; } }
Would be nice in C#:
class MyClass { public MyClass(private int x) {} }
This feature would be especially useful when working with Dependency Injection.
Best regards :)
Beta Was this translation helpful? Give feedback.
All reactions