This is First Project of Class 1:
namespace project1;
public static class Pjo
{
List<object> list1 = new List<object>();
static Pab abstate;
static Pcd cdstate;
public static Pab Abstate { get; set; }
public static Pcd Cdstate { get; set; }
public static List<object> List1 { get; set; }
public static void initialise(string elementname)
{
Pab = new Library();
List1.add(Pab);
Pcd = new Libre();
List1.add(Pcd);
}
}
This is First Project of Second class
public class process
{
foreach(var item in Pjo.List1)
{
Type type = typeof("project1.Pjo");
Methodinfo m = type.GetMethod();// i need to invoke Library File Method. Ex:pab1()
}
}
This is another project of class
namespace Lib
{
public class Library
{
int n1;
int n2;
public int N1 { get; set; }
public int N2 { get; set; }
public void Library1()
{
int n3;
n3 = n1 + n2;
}
}
public class Libre
{
int a1;
int a2;
public int A1 { get; set; }
public int A2 { get; set; }
public void Libre1()
{
int a3;
a3 = a1 + a2;
}
}
}
How to invoke the method using reflection or other method list of object in c# List of object i passing the foreach loop and i get the type of class but i can't get to invoke the method. please anyone have clear the doubt.