Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Invoke method via reflection
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Reflection; namespace Rextester { public class Program { public static void Main(string[] args) { var ob = new SomeClass(); MethodInfo method = ob.GetType().GetMethod("Do"); method.Invoke(ob, new object[] { }); } } public class SomeClass { public void Do() { Console.WriteLine("Do!"); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
*271*271#
obraek
BST
ee
WallPascal
Test1
Hello World Sub
Programmer DNA
png
retrylogic
Please log in to post a comment.