mardi 3 septembre 2019

use reflection to call a generic method [duplicate]

This question already has an answer here:

How to get the Type from reflection and pass it to another generic method as T

string assemblyPath = Environment.CurrentDirectory + "\\ConsoleApp3.exe";//This will be a Assembly/DLL in real scenario
            Assembly assembly;
            assembly = Assembly.LoadFrom(assemblyPath);
            Type type = assembly.GetType(serviceName);
            var output = objService.GetOutputObject<type>(inputObject, objServiceType1);

error

type is a variable but used like a Type





Aucun commentaire:

Enregistrer un commentaire