mardi 28 février 2017

How to put dynamic type into generic function [duplicate]

This question already has an answer here:

I got a function something like

object Get<T>(string cacheKey) where T : class;

Is there a way to call it with a dynamic object type like this -

var item = cacheProvider.Get<invocation.ReturnValue.GetType()>(cacheKey);

I was trying all sort of things but cant seem to find a way to do it.





Aucun commentaire:

Enregistrer un commentaire