Chris Straw
SHARE:

Copy Property Values using Reflection

			System.Reflection.PropertyInfo[] properties = typeof(T).GetProperties();
			foreach (System.Reflection.PropertyInfo property in properties)
			{
				System.Reflection.PropertyInfo setProperty = toObject.GetType().GetProperty(property.Name);
				if (setProperty != null)
				{
					setProperty.SetValue(toObject, property.GetValue(fromObject, null), null);
				}
				
			}