I found many examples with confusing class-definitions:
variable-declaration and direct assignment, but no standard-constructor.
Are constructors needles or is this a renewal in C#6?
Example: class Table { public int[] number = new number[10];}
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajesh SinghPosted Dec 17, 2015, 5:50 AM
1. Auto Property Initialzier
Before
The only way to initialize an Auto Property is to implement an explicit constructor and set property values inside it.
After
In C# 6, auto implemented property with initial value can be initialized without having to write the constructor. We can simplify the above example to the following:
Francis SusaimichaelPosted Dec 12, 2015, 3:44 PM