I cannot figure out why this is not working. Can anyone explain to me why SetValue does not set the value of my object's properties?
T row = new T();
foreach (PropertyInfo property in row.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
Field[] dbFields = property.GetCustomAttributes(typeof(Field), false) as Field[];
Object obj = (Int32)1000; // Arbitrary Value;
Object castObj = Convert.ChangeType(obj, property.PropertyType);
property.SetValue(row, castObj, null); // DOES NOT UPDATE row!! WHY!?
}
Any help is appreciated.