[Solved] When to use Delegate in C#, Why and does it work on a different thread? [closed]


A delegate is basically a method pointer. It has a reference to the method, and its object (unless it’s a static method, of course).

You use a delegate whenever you need to call a method but the code calling it doesn’t know which method it is. The most common reason is that the code calling the method was made before the method, e.g. a library method like List<T>.Sort(comparison).

Delegates doesn’t call the method on a different thread, it’s called on the same thread as the code using the delegate. When a method is called on a different thread it’s because the code using the delegate is already running on a different thread, or specifically starts a new thread for the method.

solved When to use Delegate in C#, Why and does it work on a different thread? [closed]