Generic Delegates in C# | CSharp Generic Delegates with Examples | Dot Net Tutorials

Veröffentlicht am: 25 September 2022
auf dem Kanal: Dot Net Tutorials
750
14

Generic Delegates in C# | CSharp Generic Delegates with Examples | Dot Net Tutorials
In this video, I am going to discuss Generic Delegates in C# with Examples. As part of this video, we are going to discuss the following pointers in detail.
1. What are Generic Delegates in C#?
2. Types of Generic Delegates in C#.
3. Why do we need the Generic Delegates?
4. Func Generic Delegate in C#?
5. Action Generic Delegate in C#?
6. Predicate Generic Delegate in C#?
7. Examples to understand Generic Delegates in C#.

What are Generic Delegates in C#?
The Generic Delegates in C# were introduced as part of .NET Framework 3.5 which does not require defining the delegate instance in order to invoke the methods. To understand the Generic Delegates in C# you should have the basic knowledge of Delegates.

Types of Generic Delegates in C#
C# provides three built-in generic delegates; they are as follows:
1. Func
2. Action
3. Predicate

What is Func Generic Delegate in C#?
The Func Generic Delegate in C# is present in the System namespace. This delegate takes one or more input parameters and returns one out parameter. The last parameter is considered as the return value. The Func Generic Delegate in C# can take up to 16 input parameters of different or the same data types. It must have one return type. The return type is mandatory but the input parameter is not mandatory.
Note: Whenever your delegate returns some value, whether by taking any input parameter or not, you need to use the Func Generic delegate in C#.

What is Action Generic Delegate in C#?
The Action Generic Delegate in C# is also present in the System namespace. It takes one or more input parameters and returns nothing. This delegate can take a maximum of 16 input parameters of the different or same data types.
Note: Whenever your delegate does not return any value, whether by taking any input parameter or not, then you need to use the Action Generic delegate in C#.

What is Predicate Generic Delegate in C#?
The Predicate Generic Delegate in C# is also present in the System namespace. This delegate is used to verify certain criteria of the method and returns the output as Boolean, either True or False. It takes one input parameter and always returns a Boolean value which is mandatory. This delegate can take a maximum of 1 input parameter and always return the value of the Boolean type.
Note: Whenever your delegate returns a Boolean value, by taking only one input parameter, then you need to use the Predicate Generic delegate in C#.

The text document of this video: https://dotnettutorials.net/lesson/ge...

#genericdelegates #csharpgenericdelegates #csharpgenericdelegatesexamples #genericdelegatesexamples #dotnetutorials #csharp #csharptutorials #pranaya #pranayarout

Generic Delegates
Generic Delegates in C#
Generic Delegates in C# with Examples
Generic Delegates in CSharp
Generic Delegates in CSharp with Examples
C# Generic Delegates
C# Generic Delegates Examples
C# Generic Delegates with Examples
CSharp Generic Delegates
CSharp Generic Delegates Examples
CSharp Generic Delegates with Examples
Func Generic Delegate
Action Generic Delegate
Predicate Generic Delegate


Auf dieser Seite können Sie das Online-Video Generic Delegates in C# | CSharp Generic Delegates with Examples | Dot Net Tutorials mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Dot Net Tutorials 25 September 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 750 Mal angesehen und es wurde von 14 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!