I have a class whose method i want to invoke dynamically.But i am not able to do it. Am i missing something?
public class P_WATER
{
private int[] jDS = new int[20];
private int n;
public int[] JDS { get => jDS; set => jDS = value; }
public int N { get => n; set => n = value; }
public void P_WATER1()
{
//something...
}
}
public class Test
{
P_WATER P_WATERState1 = new P_WATER();
PLibStateList.Add(P_WATERState1);
//Try to invoke methods from each objects.
foreach (object item in StateUtility.PLibStateList)
{
Type objType= item.GetType();
objType.InvokeMember(objType.Name + "1", BindingFlags.InvokeMethod, null, item, null);
}
}
When trying to invoke the method i am getting the following exception Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
But my assembly is well bound to the project.
Aucun commentaire:
Enregistrer un commentaire