Delegates Part 2

Delegates Part 1 Delegates Part 2 Prerequisits You want to read the second part of Delegates, right? The first thing that you need is to read the previous part (Part 1). The next thing is putting a smile please put a smile on your face then start to read the article. Target methods As you remember, we agreed that a delegate can point to a method, right? In simple words, it means that we can have a variable that can hold a method in it and then we can call that method by calling this variable. We have local, static, and instance methods in C#, so the delegate can point to which of them? All! A delegate’s target method can be a local, static, or instance method. ...

October 4, 2023 · 9 min · 1726 words · Kamran Sadin

Delegates Part 1 Plugin Methods With Delegates

Delegates Part 1 Delegates Part 2 This post is just to get familiar with Delegates in C#, in the next posts I will talk about delegates in advance. What is Delegate A delegate is an object that knows how to call a method. {: .prompt-tip } You know variables in C#, right? A delegate is a reference type variable that holds the reference to a method and the reference can be changed at runtime. Delegates are usually used for implementing events and the call-back methods (We will get back to this soon). Before getting started, let’s see the syntax of a delegate: ...

October 1, 2023 · 4 min · 754 words · Kamran Sadin