3

I have the following: typeof(Action<User, Int32>) which I need to be able to create dynamically...

I have both of the types I need stored as a Type object.

Type type1 = ...; // MyNamespace.BusinessObjects.User Type type2 = ...; // System.Int32 // I need it to be Action<MyNamespace.BusinessObjects.User, System.Int32> Type action = ? ; 

Not sure what to do here to get this going.

1 Answer 1

5

I think this should work:

var actionType = typeof(Action<,>).MakeGenericType(type1,type2); 
Sign up to request clarification or add additional context in comments.

1 Comment

@m-y It was a great question though

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.