Declare and use read write properties in C# Part 1 – Declare the backing fields
1 min read

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.

        private string _name = "N/A";
        private int _age = 0;

Great! Now in the next post we’ll declare the properties.

Leave a Reply