-There are programs Delegate is declared in one file and instantiate in another file in the same folder.
-Also there are programs Delegate declaration and instantiation is done in the same file.
I wish to know how a programmer can decide which is appropriate in above two.


Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Oct 18, 2015, 3:20 AM EDT
Mukesh KumarRank #119 · 18.2K reputationPosted Oct 16, 2015, 9:00 PM EDT
These are different way to declare the delegate.. if you believe that your declared delegate should not be accessible to other one try to use it in the same program of class.
Thanks
MahaRank #2,573 · 543 reputationPosted Oct 17, 2015, 1:25 AM EDT
MahaRank #2,573 · 543 reputationPosted Oct 18, 2015, 12:37 PM EDT
This article seems very interesting. Thank you for introducing this article Upendra Pratap Shahi.
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Oct 19, 2015, 9:21 PM EDT
MahaRank #2,573 · 543 reputationPosted Oct 19, 2015, 11:46 PM EDT
In the 5th paragraph of the article says:
“In this next example, we instantiate a delegate of type GetAString, and then initialize it so it refers to the ToString() method of the integer……………………….”
I do not agree with word “instantiate”. Here we are not instantiating just we are declaring or defining a delegate. In my view instantiating means:
GetAString x = new GetAString();
What you think Upendra Pratap Shahi.
MahaRank #2,573 · 543 reputationPosted Oct 20, 2015, 1:23 AM EDT
Other thing is in this example Delegate is declared in inside the class of the existing class (in our case, the Test class).
Whether you declared a Delegate inside the class or outside the class the output becomes same. I wish to know whether location of Delegate declaration is the matter.
Mukesh KumarRank #119 · 18.2K reputationPosted Oct 20, 2015, 1:32 AM EDT