Silas2
asked on
Anonymous Property
Say you have an anon method:
(I have multiple-objects with the same property name and i don't want to use an interface)
public string GetObjAndSetProp<T>(Func<T> makeNew, string newPropValue)
{
T item = makeNew();
item.MyCustomProperty = newPropValue; //how do you do this???
}
how do i set the MyCustomProperty value on the anon type T/item?(I have multiple-objects with the same property name and i don't want to use an interface)
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You certainly can use Reflection, but I wouldn't suspect it would be warranted in this particular case.
ASKER