
Enjoy technology & code with step by step instructions
LATEST POSTS

Declare and use read write properties in C# Part 3 – Create an instance of the Person class and set values on the object
So finally we’ll create a new instance of the class inside our Main of the TestPerson class. Then we’ll set some values on the object and then increment the property. Time to run the app! Great work Sherlock!

Declare and use read write properties in C# Part 2 – Declare the properties
Now it’s time to declare the properties in the Person class. There we go! Now in the last post we’ll create two instances of the Person class and set some values on our two objects.

Declare and use read write properties in C#
Declare the backing fields Declare the properties Create an instance of the Person class and set values on the object

Declare and use read write properties in C# Part 1 – Declare the backing fields
Let’s continue with our C# programming guide here. This builds on our previous post here on C# classes. First edit the code for the Person class. Remove the constructor that sets the name property and the existing property. Next add the backing fields. Great! Now in the next post we’ll declare the properties.
Loading…
Something went wrong. Please refresh the page and/or try again.