Can a C# method return a method?

The Types you are looking for are Action<> or Func<>.

The generic parameters on both types determine the type signature of the method. If your method has no return value use Action. If it has a return value use Func whereby the last generic parameter is the return type.

For example:

public void DoSomething()                          // Action
public void DoSomething(int number)                // Action<int>
public void DoSomething(int number, string text)   // Action<int,string>

public int DoSomething()                           // Func<int>
public int DoSomething(float number)               // Func<float,int>
public int DoSomething(float number, string text)  // Func<float,string,int>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)