I have a class:
public class Test1
{
public void assignData(List<CustomClass> customData, string targetFieldName)
{
for(int i=0; i<customData.Count; i++)
{
if(customData[i].targetFieldName)
{
customData[i].targetFieldName = newValue;
}
}
}
}
List<customClass1> list1;
List<customClass2> list2;
customClass1 and customClass2 are completely different, but they share the same field 'dateAdded'. I want to be able to call Test1.assignData(list1, "dateAdded") and Test1.assignData(list2, "dateAdded"). and the list1 and list2 will get updated. How can I do that? Thanks!