Func Delegate in C sharp Arabic #98



Func Delegate in C sharp Arabic #98

Suggested Videos

 ❑ Purpose of Func<T.TResult>delegate in C#.

What is Func<T,TResult> in C#? In simple terms, Func<T,IResult> is just  a generic delegate .Depending on the requirement , the type parameters (T and TResult) can be replaced with the corresponding type arguments

For example , Fun<Employee, string> is a delegate that represents a function expecting Employee object as an input parameter and returns a string.



What is the difference between func delegate and lambda expression? They’re the same ,just two different ways to write the same thing . The lambda syntax is newer, more  concise  and easy to write 

What if I have to pass two or more  input parameters? As of this recording there are 17  overloaded versions of Func , which enables us to pass  varisble number and type of input  parameters. In the example  below, Func<int , string>  represents a function that expects 2 int input parameters and returns a string. 



Follow Us

YouTube

 If you want to download pptx : click Telegram

Facebook

Twitter

Instagram

Tik To

إرسال تعليق

أحدث أقدم