I am having a hard time understanding how properties are "connected" to backing fields. I've set up a common example. I often see get and set simplified to {get; set;}. Is this only appropriate when one field is present or can it still work with two same-type fields. If it does work, is the name property in this code acting on behalf of name or address or both? I'm having a hard time understanding the importance of the private field if the information that would be stored there is stored/accessed in a public property. Is that making sense?
using System;
namespace MyApplication
{
class Program
{
static void Main(string[] args)
{
Person myObj = new Person();
myObj.Name = "Liam";
Console.WriteLine(myObj.Name);
}
}
class Person
{
private string name;
private string address;
public string Name {get; set;}
}
}