Does someone knows if it's possible to dynamically create a call chain and invoke it?
Lets say I have two classes A & B:
public class A
public function Func() as B
return new B()
end function
end class
public class B
public function Name() as string
return "a string";
end function
end class
I want to be able to get MethodInfo for both Func() & Name() and invoke them dynamically so that I can get a call similar to A.Func().Name().
I know I can use Delegate.CreateDelegate to create a delegate I can invoke from the two MethodInfo objects but this way I can only call the two functions separately and not as part of a call chain.
I would like two solutions one for .NET 3.5 using expression tree and if possible a solution that is .NET 2.0 compatible as well