C# Reflection Invoke Static method of Type

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public static void Main()
	{
		var method = typeof(Math).GetMethod("Exp");
		var result = method.Invoke(null, new object[] {2});//Pass null as the first argument (no need for an instance)
    	Console.WriteLine(result); //You'll get e^2
	}
}
;