Execute method in C# using reflection
namespace MyCompany{[TestFixture]public class Test{[Test]public void Test1(){MyClass obj = new MyClass();MethodInfo m = obj.GetType().GetMethod("Test");m.Invoke(obj, null);}public class MyClass{public void Test(){Console.WriteLine("Test");}}}
Comments
Post a Comment