This project has moved and is read-only. For the latest updates, please go here.

How about generic method invocations?

Topics: Developer Forum, Project Management Forum, User Forum
Jul 15, 2008 at 9:05 AM
Edited Jul 15, 2008 at 9:24 AM
I'd like to use your approach to handling generic class instantiation and generic method  invocation, but I don't see any way to do it.

Here's a sample of code I'd like to use it for.

creating a strongly typed object:

CreateObject<T>( string a, int b, params object[] c )
  SomeObject<T> rv = new SomeObject<T>( a, b, c )

  return rv;

calling a strongly typed generic proc or function:

void Foo<T>( T arg1, T arg2 ) {}
Q bar<Q>( int i, double j ) { }

Is there a way to accomplish this with your library? At the moment the only way to accomplish this at runtime is to get a Type or MethodInfo handle then call MakeGeneric on it.