Sure, MakeGenericType
will be able to do this for you.
Type genericAction = typeof(Action<>);
var someType = new CustomerMessageHandler<CustomerMessage>();
var nType = someType.GetGenericArguments().First().GetType();
var actionType = genericAction.MakeGenericType(new[] { nType });
Note however that an Action<T>
is a delegate that should actually DO something... So you'd need to write a body for that:
var actualMethod = Delegate.CreateDelegate(actionType, **your method info here**);