Posts

Showing posts with the label #FuncDelegate

C# Func Delegate

Image
C# includes built-in generic delegate types   Func   and   Action , so that you don't need to define custom delegates manually in most cases. Func  is a generic delegate included in the  System  namespace. It has zero or more  input  parameters and one  out  parameter. The last parameter is considered as an out parameter. The  Func  delegate that takes one input parameter and one out parameter is defined in the  System  namespace, as shown below: Signature: Func namespace System { public delegate TResult Func< in T, out TResult>(T arg); } The last parameter in the angle brackets  <>  is considered the return type, and the remaining parameters are considered input parameter types, as shown in the following figure. Func delegate A Func delegate with two input parameters and one out parameters will be represented as shown below. Func delegate The following  Func  delegate take...