what is current situations or secnarios it must use delegate ?

ahmed salah 3,136 Reputation points

I working on csharp i need to know what is current situations and scenarios it must use delegate on it
i talk generally without code
i mean cases it must use delegate and event

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
8,189 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jack J Jun 23,661 Reputation points Microsoft Vendor

    @ahmed salah , Welcome to Microsoft Q&A, you could refer to the following link to know when we should the delegate.

    When would you use delegates in C#?

    Including the following points:

    1. Event handlers (for GUI and more)
    2. Starting threads
    3. Callbacks (e.g. for async APIs)
    4. LINQ and similar (List.Find etc)
    5. Anywhere else where I want to effectively apply "template" code with some specialized logic inside (where the delegate provides the specialization) i mean cases it must use delegate and event

    If you mean that you want to use event, it is often used in GUI app. (First Point)

    Hope my explanation could help you.

    Best Regards,

    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.