I previously had an issue with using reflection that you can see here.
After having received an answer to the question and attempted to implement it to my project I seem to have hit yet another wall.
Basically I have this code:
String[] arr = {"", conStr, ""};
var myType = (typeof(JaberoDC.JaberoDC.JaberoDC));
var method = myType.GetMethods(param, BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).Single(mi => mi.ReturnType == typeof(DataSet));
var subject = Activator.CreateInstance(myType);
var result = method.Invoke(subject, arr);
DataSet ds = (DataSet)result;
Where param is a String.
However, it doesn't seem to work as intended.
The line
var method = myType.GetMethods (param, BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly) .Single(mi => mi.ReturnType == typeof(DataSet));
Throws the error
Unkown method GetMethods(string, System.Reflection.BindingFlags) of System.Type
And
mi => mi.ReturnType == typeof(DataSet));
Throws this error:
Unkown type of variable mi
Could anyone help me with the correct initialization of my method variable. I've looked around on Google to see if I could possibly find something to at least point me in the right direction. My previous code (again, see the other question) compiled and ran, but threw an ambiguous match found error.
Aucun commentaire:
Enregistrer un commentaire