protected void SetPhonebookValues(Phonebook phonebook, System.Collections.Specialized.OrderedDictionary newValues) { foreach (string fieldName in Utilities.GetPropertyNames<Phonebook>()) { if (newValues[fieldName] != null) { PropertyInfo propertyInfo = phonebook.GetType().GetProperty(fieldName); phonebook.SetMemberValue(fieldName, Convert.ChangeType(newValues[fieldName], propertyInfo.PropertyType)); } } }