mardi 12 juillet 2016

Reflection parameter missmatch

I've looked around on SO and Google on some similar issues, but can't find anyway of solving my problem.

Basically I'm getting a parameter mismatch on this code in one of the classes of my restful API:

Param is a string (the name of the method I'm looking to use).

    var method = myType
        .GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)
        .Single(mi =>mi.ReturnType == typeof(DataSet) 
        && string.Equals(mi.Name, param, StringComparison.OrdinalIgnoreCase));
    var subject = Activator.CreateInstance(myType);
    var result = method.Invoke(subject, new Object[] {"", conStr, ""}); //error here

Although I'm invoking the exact same method as this:

DataSet ds = jdc.FETCHvw_WorksiteEntry("", conStr, "");

enter image description here

Any clues?





Aucun commentaire:

Enregistrer un commentaire