C# auto-initialize propertyC# auto-initialize property is a feature, introduced in 6.0. It allows us to initialize properties without creating a constructor. Now, we can initialize properties along with declaration. In early versions, constructor is required to initialize properties. An old approach is used in the following example. C# Example without auto-initialize propertyOutput Rahul Kumar Now, we don't need to create constructor. See, the following example. C# Example with auto-initialize propertyOutput Rahul Kumar We can make a property restrict to change by setting private modifier. See, the following example. C# Example with auto-initialize propertyOutput Rahul Kumar |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India