Y
Yahoo
I have an object being passed into a method that I know implements the +
operator. How can I execute this method if I dont know its type?
What I want to do is...
public object Add(object o1, object o2)
{
//what needs to happen
//return o1 + o2;
//What i want to do...
return o1.getType().InvokeMember("+", new object(){o1, o2});
}
o1 and o2 would be both either a double, int, string, long, or my own
classes that implement the + operator.
operator. How can I execute this method if I dont know its type?
What I want to do is...
public object Add(object o1, object o2)
{
//what needs to happen
//return o1 + o2;
//What i want to do...
return o1.getType().InvokeMember("+", new object(){o1, o2});
}
o1 and o2 would be both either a double, int, string, long, or my own
classes that implement the + operator.