dimanche 14 juillet 2019

C# Calling Math Function from String

I want to call Math.Round() and I've tried the following but it give me error

string mathFunc = "Round";

MethodInfo method = Math.GetType().GetMethod(mathFunc); // error
Console.WriteLine(method.Invoke(this, 1.78d));





Aucun commentaire:

Enregistrer un commentaire