I have a static method that has the signature:
pubic static foo (float,float,IEnumberable<IEnumberable<double>>)
I'm using reflection to call this method with arguments of
int, int, and List<List<double>>,
this fails, it appears to me that the List<List<double>>
parameter is failing to be converted. I'm using the code below to attempt to convert parameters
Is this possible? A limitation of reflection? I would have thought that List implemented the IEnumerable interface and would just work.
var args = inputportvals.Select(x=>
{
if (x.First is IronPython.Runtime.List || x.First is IDynamicMetaObjectProvider)
{
return x.First;
}
if (x.First is IEnumerable || x.First is IList)
{
return x.First as IEnumerable;
}
else
{
return Convert.ChangeType(x.First, infos.Where(y=>y.Name == x.Second).First().ParameterType);
}
}
).ToArray();
funcdef.MethodPointer.Invoke(null,args);
Aucun commentaire:
Enregistrer un commentaire