Delegate for any method type - C#

后端 未结 4 404
遥遥无期
遥遥无期 2021-01-01 18:07

I want to have a class that will execute any external method, like this:

class CrazyClass
{
  //other stuff

  public AnyReturnType Execute(AnyKindOfMethod M         


        
4条回答
  •  旧时难觅i
    2021-01-01 18:46

    public static void AnyFuncExecutor(Action a)
    {
        try
        {
            a();
        }
        catch (Exception exception)
        {
            throw;
        }
    }
    

提交回复
热议问题