Home >Backend Development >C#.Net Tutorial >How many types of c# delegates are there?
C# There are two types of delegates: unicast delegates point to a single method, and multicast delegates point to multiple methods. The unicast delegate only calls registered methods, and the multicast delegate calls all methods in the order of registration. The choice of delegation type depends on the scenario requirements: use unicast delegation when only one method is used; use multicast delegation when multiple methods need to be called.
C# Types of Delegates
In C#, there are two main types of delegates:
1. Unicast delegate
2. Multicast delegate
The difference between unicast delegation and multicast delegation
In addition to the number of pointed methods, unicast delegation and multicast delegation also have different behaviors. Difference:
Select the delegation type
Selecting unicast delegation or multicast delegation depends on the needs of the specific scenario:
The above is the detailed content of How many types of c# delegates are there?. For more information, please follow other related articles on the PHP Chinese website!