Linked Questions

114 votes
8 answers
51k views

What are some real world places that call for delegates? I'm curious what situations or patterns are present where this method is the best solution. No code required.
slipsec's user avatar
  • 3,070
0 votes
1 answer
2k views

Hi Folks i am trying to learn more about the Action Delegates in C# but i dont understand it so good. So below i have a Code Example from a Unity C# Project. My Question is. What is the purpose of ...
Hakki Uzel's user avatar
3 votes
2 answers
714 views

Possible Duplicate: when & why to use delegates? I understand most of C# syntax, and I partially understand delegates, but I cannot find any case I would need to use them. Can you help me ...
Josell's user avatar
  • 1,934
-1 votes
1 answer
857 views

Can anybody explain to me why we need delegates and what are the advantages of them? Here is a simple program I have created with and without delegates (using plain methods): Program with without ...
King_Fisher's user avatar
  • 1,223
0 votes
0 answers
150 views

using System; namespace multicastdeligate { delegate void Del1(int s); class TestClass { static void number(int s) { System.Console.WriteLine(" Hello, {0}!", s)...
Joyner's user avatar
  • 312
0 votes
0 answers
59 views

I have an understanding of delegate concept, but not getting the scenarios of when to implement delegate and to write a method. Please anyone help me on this.
Priyanka Yemul's user avatar
371 votes
13 answers
460k views

I understand the purpose of events, especially within the context of creating user interfaces. I think this is the prototype for creating an event: public void EventName(object sender, EventArgs e); ...
Levi Campbell's user avatar
24 votes
18 answers
60k views

According to anti-if campaign it is a best practice not to use ifs in our code. Can anyone tell me if it possible to get rid of the if in this piece of code ? (switch is also not an option, The ...
Omu's user avatar
  • 71.6k
59 votes
8 answers
36k views

I never seem to understand why we need delegates? I know they are immutable reference types that hold reference of a method but why can't we just call the method directly, instead of calling it via a ...
InfoLearner's user avatar
  • 15.6k
2 votes
4 answers
3k views

I have two forms, I want to reload combobox items in Form1 from Form2. I set Form1 as MdiParent of Form2 like this: Form2 f2 = new Form2(); f2.MdiParent = this; f2.Show(); How can I access Form1 ...
Ehsan's user avatar
  • 2,295
2 votes
2 answers
4k views

How can I add items to my comboBox which is in Form1, but the funcion that add items to that combo box is in another class ? public void comboBox1_Categories_Load() { SqlConnection con = new ...
Marox's user avatar
  • 369
0 votes
3 answers
6k views

I want to access a DataGridView from another form. I just want to get a value from DataGridView and show it in a textbox located in another form. As shown in the photo: I click Edit line button and ...
naouf's user avatar
  • 637
0 votes
2 answers
2k views

I have trouble using System.Func. public Func<int> OnCreated=new Func<int>(int ASD){ Debug.Log (ASD); }; Is this the proper way to use it? I want to make a dynamic function that can be ...
Tire Fruck's user avatar
2 votes
1 answer
735 views

I don't understand the need for the additional "delegate"-layer in the following code, from Learning Python, 5ed, by Mark Lutz: class Super: def method(self): print('in Super.method') ...
user2964194's user avatar
0 votes
2 answers
322 views

I really enjoy using the aggregate functions that C# provides such as .Any(), but I struggle to understand what my options are just looking from the method signature: Can someone help me better ...
Paul Duer's user avatar
  • 1,140

15 30 50 per page