What is the purpose of the delegates are immutable in c#?

Viewed 1396

I was reading a book illustrated C # 2012 in the section Combining Delegates point not notice that? Purpose of the delegates are immutable.

Combining Delegates All the delegates you’ve seen so far have had only a single method in their invocation lists. Delegates can be “combined” by using the addition operator. The result of the operation is the creation of a new delegate, with an invocation list that is the concatenation of copies of the invocation lists of the two operand delegates. For example, the following code creates three delegates. The third delegate is created from the combination of the first two.

MyDel delA = myInstObj.MyM1;
MyDel delB = SClass.OtherM2;
MyDel delC = delA + delB; // Has combined invocation list

Although the term combining delegates might give the impression that the operand delegates are modified, they are not changed at all. In fact, delegates are immutable. After a delegate object is created, it cannot be changed. Figure 15-6 illustrates the results of the preceding code. Notice that the operand delegates remain unchanged.

enter image description here

2 Answers
Related