G
Guest
Hi,
I hope this is the right forum for this question.
I am trying to use reflection for several custom collection classes. For
example, what I want to do is take a line of code like this:
myCollection.Add(mySecondCollection.Item(i))
and rewrite it using reflection.
So far, I have something like
object myObject = new object();
object mySecondObject = new object();
myObject = myCollection;
mySecondObject = mySecondCollection;
myCollection.GetType().GetMethod("Add").Invoke(....
After the invoke is where I am confused about the syntax to use to represent
the second collection, and to represent the .Item syntax (.Item is a custom
method that returns an object in the collection and takes the collection
index as an argument).
I have read the documentation for .GetMethod, .Invoke, etc. and don't
understand what I'm supposed to do in this case.
Any help would be greatly appreciated.
Thanks!
I hope this is the right forum for this question.
I am trying to use reflection for several custom collection classes. For
example, what I want to do is take a line of code like this:
myCollection.Add(mySecondCollection.Item(i))
and rewrite it using reflection.
So far, I have something like
object myObject = new object();
object mySecondObject = new object();
myObject = myCollection;
mySecondObject = mySecondCollection;
myCollection.GetType().GetMethod("Add").Invoke(....
After the invoke is where I am confused about the syntax to use to represent
the second collection, and to represent the .Item syntax (.Item is a custom
method that returns an object in the collection and takes the collection
index as an argument).
I have read the documentation for .GetMethod, .Invoke, etc. and don't
understand what I'm supposed to do in this case.
Any help would be greatly appreciated.
Thanks!