B
Brian Bischof
I'm trying to loop through each field in a class and print its value out.
Using reflection I can build a list of the fields/methods/properties etc.
and I can use InvokeMember() to create a new class in memory. But I can only
do this by using the an object's Type and creating an empty instance of it.
I need to use an object variable that already exists and call these same
methods on it. Is there a way to perform reflection on an existing variable?
I tried to call InvokeMember() and pass it the existing variable so that it
copies it into memory, but no such override exists.
I've also experimented with Activator.CreateInstance() but it doesn't take
existing objects either.
Thanks.
Using reflection I can build a list of the fields/methods/properties etc.
and I can use InvokeMember() to create a new class in memory. But I can only
do this by using the an object's Type and creating an empty instance of it.
I need to use an object variable that already exists and call these same
methods on it. Is there a way to perform reflection on an existing variable?
I tried to call InvokeMember() and pass it the existing variable so that it
copies it into memory, but no such override exists.
I've also experimented with Activator.CreateInstance() but it doesn't take
existing objects either.
Thanks.