It's there a way to invoke a generic methodInfo?

EDIT: Okay, since your question edit it looks like you're already calling MakeGenericMethod. Good Now, once you've managed to invoke the method, there's then the matter of making an appropriate anonymous type. I would suggest you create a generic type and use Type.

MakeGenericType on the generic type definition, then construct an instance of that. Alternatively, you could have another generic method which is strongly typed, and invoke that with reflection in a similar way. That method could use an anonymous type: public object CreateResult(TTable t, TJoin joinTable) { return new { FromT = t, InnerT = joinTable }; } You could call your generic MethodInfo helper to make it easier to invoke this.

EDIT: Okay, since your question edit it looks like you're already calling MakeGenericMethod. Good. Now, once you've managed to invoke the method, there's then the matter of making an appropriate anonymous type.

I would suggest you create a generic type and use Type. MakeGenericType on the generic type definition, then construct an instance of that. Alternatively, you could have another generic method which is strongly typed, and invoke that with reflection in a similar way.

That method could use an anonymous type: public object CreateResult(TTable t, TJoin joinTable) { return new { FromT = t, InnerT = joinTable }; } You could call your generic MethodInfo helper to make it easier to invoke this.

GetTableType. MakeGenericMethod(versionTableType). Invoke ... doent's work because return an object, and not my type – Cédric Boivin Dec 8 '09 at 14:01 It's declared to return object, but it will actually return the right type.

That type is only known at execution, so to build an anonymous type with the right property type, you'll need to use reflection again. – Jon Skeet Dec 8 '09 at 14:04 It's a good idea – Cédric Boivin Dec 8 '09 at 14:09.

I Auto resolve my solutions, inspired from Jon Skeet answer. I create a class generic public class ConvertTable where TInner : class where TOuter : class { public TOuter FromT { get; set; } public TInner InnerT { get; set; } public ConvertTable(TOuter fromT, TInner innerT) { FromT = fromT; InnerT = innerT; } }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions