c# - Func as input parameter -


I have the following method in C # with some parameters:

  public static void DeleteSingleItemInDataGrid (DataGrid DataGrid, String IDcolumnName, Func & lt; int & gt; afterCompletionMethod_ToRun)   

I type the third parameter type to Func & lt; Zero & gt; But I can not do how can I do it?

In other words My question is how can a method (or function with zero result ) pass as a method parameter?

A representative refers to a method that returns "return" zero to The name of the representative is also in the Action .net language, and so on:

  • Then your method will sign it: < / P>

    And not back int , it will be:

      public Nick Static Zero DeleteSingleItemInDataGrid (DataGrid DataGrid, String IDcolumnName, Action & lt; int & gt; End End Method Method) / Code>  

    This is a method adopted by taking a int parameter Does not return anything (aka "back" zero ).

    It also means that you can not create a general method which accepts methods that return some methods and some accept the methods to return only with one method, But the need to create surcharge by using action , and Func & lt; T & gt; .

Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -