Answers for "Pass Method as Parameter using C#"

C#
1

Pass Method as Parameter using C#

public class Class1
{
    public int Method1(string input)
    {
        //... do something
        return 0;
    }

    public int Method2(string input)
    {
        //... do something different
        return 1;
    }

    public bool RunTheMethod(Func<string, int> myMethodName)
    {
        //... do stuff
        int i = myMethodName("My String");
        //... do more stuff
        return true;
    }

    public bool Test()
    {
        return RunTheMethod(Method1);
    }
}
Posted by: Guest on April-26-2021

Code answers related to "Pass Method as Parameter using C#"

C# Answers by Framework

Browse Popular Code Answers by Language