How to pass variable of type “Type” to generic parameter?

You need to use reflection for this var method = typeof(MetaDataUtil) . GetMethod("GetColumnasGrid") . MakeGenericMethod(new { type }) .

Invoke(null, null).

You need to use reflection for this. Var method = typeof(MetaDataUtil) . GetMethod("GetColumnasGrid") .

MakeGenericMethod(new { type }) . Invoke(null, null).

Generics offer Compile Time parametric polymorphism. You are trying to use them with a type specified only at Runtime. Short answer : it won't work and it has no reason to (except with reflection but that is a different beast altogether).

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