I have a static List like this:
class Program
{
public static List<Action> List { get; set; }
static void Main(string[] args)
{
Test test = new Test();
test.Work();
var type = test.GetType();
var method = type.GetMethod("Action1",System.Reflection.BindingFlags.Instance|System.Reflection.BindingFlags.NonPublic);
//Console.WriteLine(List.Any(p => p == new Action(method.)));
}
}
public class Test
{
public void Work()
{
Program.List.Add(new Action(Action1));
}
private void Action1()
{
}
}
How can I judge the Program.List contains Action1 by Reflection?
Aucun commentaire:
Enregistrer un commentaire