Property accessors are a pretty useful addition to Object Oriented Programming; they allow for class designers to restrict and abstract what would normally be simple values by using "getter" and "setter" logic. Though properties normally just expose a private variable, sometimes it's helpful to include a bit of additional logic of some sort. Russ noticed that the designers of the "Contact" class he was using didn't quite understand the "a bit" part ...

//ED: Found in code utilizing the class
string firstName = contactDetails.contact.firstName; //saves
string lastName = contactDetails.contact.lastName; //saves
string address1 = contactDetails.contact.address1;  
string address2 = contactDetails.contact.address2;
string primaryPhone = contactDetails.contact.primaryPhone; //saves


//ED: From the Contact class ...
/// <summary>
/// Gets or sets the contact passed to it.
/// This hasn't neccessarily been saved to the database 
/// </summary>
public Contact contact 
{
  get 
  { 
    return SaveToDatabase();
  }
  set
  {
    LoadFromContact(value);
  }
}
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!