Linked Questions
26 questions linked to/from When & why to use delegates?
114
votes
8
answers
51k
views
Where do I use delegates? [closed]
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.
0
votes
1
answer
2k
views
What is the purpose of a Action callback delegate? [duplicate]
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 ...
3
votes
2
answers
714
views
Have you a simple yet useful example to understand delegates' purpose? [duplicate]
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 ...
-1
votes
1
answer
857
views
What is the purpose of delegates and what are their advantages? [duplicate]
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 ...
0
votes
0
answers
150
views
What is the advantage of calling method through delegates over calling with the help of class object in c# [duplicate]
using System;
namespace multicastdeligate
{
delegate void Del1(int s);
class TestClass
{
static void number(int s)
{
System.Console.WriteLine(" Hello, {0}!", s)...
0
votes
0
answers
59
views
Not getting when to implement delegates and to write a method [duplicate]
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.
371
votes
13
answers
460k
views
Understanding events and event handlers in C# [closed]
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);
...
24
votes
18
answers
60k
views
do this without using an "if" | if(s == "value1"){...} else if(s == "value2") { ...}
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 ...
59
votes
8
answers
36k
views
Why do we need C# delegates
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 ...
2
votes
4
answers
3k
views
Reload combobox items from another form
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 ...
2
votes
2
answers
4k
views
How to add items to combobox from another class
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 ...
0
votes
3
answers
6k
views
How do I access DataGridView from another form?
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 ...
0
votes
2
answers
2k
views
How can I use System.Func?
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 ...
2
votes
1
answer
735
views
delegation in python oop
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')
...
0
votes
2
answers
322
views
How to correctly read the method signature of the .Any function in C#
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 ...