delegates Questions

3

Solved

Sorry, this is a mix of C# and VB.Net I have a C# class with with 2 delegates: public delegate string GetSettingDelegate(string key); public event GetSettingDelegate GetSettingEvent; public dele...
Pneumatology asked 23/5, 2011 at 22:56

6

Are delegates the same thing as callbacks? Or are they related somehow?
Spurling asked 14/11, 2008 at 17:41

5

Solved

I am working on an app where I have created modules for each feature of the app. I have to switch from one Module UI Controller to another Module UI Controller. I have UIController in a Module and...
Scandent asked 7/1, 2019 at 11:37

10

Solved

How would you dynamically subscribe to a C# event so that given a Object instance and a String name containing the name of the event, you subscribe to that event and do something (write to the cons...
Willmert asked 5/9, 2008 at 13:17

3

Solved

An open delegate is a delegate to an instance method without the target. To call it you supply the target as its first parameter. They are a clever way to optimize code that otherwise would use ref...
Ganja asked 3/11, 2010 at 9:51

4

Solved

I wanna change the number of the TextBox when The Mouse Scrolls. I have a Scroll TextBox But I Don't wanna use that. Is There any Event related to this? Should I write an TextBox Event? If yes, How...
Neuropathy asked 31/10, 2014 at 9:53

6

Solved

I have a class which has a delegate member. I can set the delegate for each instantiated object of that class but has not found any way to save that object yet
Mila asked 15/7, 2009 at 17:11

2

Im getting the warning "Non-nullable event 'SomeEvent' must contain a non-null value when exiting constructor. Consider declaring the event as nullable." Here's a very simplified version ...
Anticipant asked 22/10, 2021 at 12:1

5

Solved

I expect this to sound like an obvious question but, does the delegate return type have to match the return type of the method it is delegating too? EG, like this: public static void Save() { T...
Klusek asked 10/12, 2012 at 14:3

2

To preface, this problem has been solved using a couple of different methods - I'll leave the stack overflow post that has the solution here text The problem deals with detecting when the "del...
Seringa asked 14/7, 2023 at 5:27

15

Solved

Several Linq.Enumerable functions take an IEqualityComparer<T>. Is there a convenient wrapper class that adapts a delegate(T,T)=>bool to implement IEqualityComparer<T>? It's easy eno...
Poor asked 18/9, 2008 at 23:34

9

Solved

I have the following code: Func<string, bool> comparer = delegate(string value) { return value != "0"; }; However, the following does not compile: var comparer = delegate(string value) {...
Bathurst asked 11/2, 2011 at 4:17

6

Solved

Is there any way to get a delegate to run on a specific thread? Say I have: CustomDelegate del = someObject.someFunction; Thread dedicatedThread = ThreadList[x]; Can I have a consistent backgro...
Rockabilly asked 13/8, 2010 at 22:26

7

Solved

Why is a Func<> created from an Expression<Func<>> via .Compile() considerably slower than just using a Func<> declared directly ? I just changed from using a Func<IInte...
Unideaed asked 18/11, 2010 at 3:27

7

Solved

I have been trying to learn a bit more about delegates and lambdas while working on a small cooking project that involves temperature conversion as well as some cooking measurement conversions such...
Beria asked 21/10, 2011 at 15:10

3

Solved

I've implemented this short example to try to demonstrate a simple delegation pattern. My question is. Does this look like I've understood delegation right? class Handler: def __init__(self, pare...
Armful asked 4/9, 2010 at 18:47

11

Solved

I have a weird problem. I get this error: -[FourSquareCheckInViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7aecc0 2012-09-14 19:18:39.039 [5869:707] *...
Nonbeliever asked 14/9, 2012 at 19:45

22

Solved

I have to do some operation whenever UICollectionView has been loaded completely, i.e. at that time all the UICollectionView's datasource / layout methods should be called. How do I know that?? Is ...
Selenite asked 24/12, 2012 at 10:23

4

Solved

Take the below code: private void anEvent(object sender, EventArgs e) { //some code } What is the difference between the following ? [object].[event] += anEvent; //and [object].[event] += ...
Dniren asked 15/2, 2009 at 10:55

12

Solved

This may be something common and trivial, but I seem to be having trouble finding a concrete answer. In C# there is a concept of delegates, which relates strongly to the idea of function pointers f...
Arielle asked 2/7, 2009 at 9:19

20

Solved

I know how delegates work, and I know how I can use them. But how do I create them?
Boding asked 9/3, 2009 at 16:6

8

Solved

weak references don't seem to work in Swift unless a protocol is declared as @objc, which I don't want in a pure Swift app. This code gives a compile error (weak cannot be applied to non-class typ...
Marcos asked 5/6, 2014 at 17:16

9

Solved

I would like to create a method that takes an event as an argument and adds eventHandler to it to handle it properly. Like this: I have two events: public event EventHandler Click; public event E...
Travesty asked 1/4, 2010 at 12:27

4

Solved

In my main class 'A' I have declared a function and delegate to call that function, I want to pass my delegate to another class 'B' but how will class B know what type the delegate is? class A pu...
Sturgeon asked 31/3, 2011 at 15:57

4

Solved

I try to compile the following code in C#: public static T FirstEffective(IEnumerable<T> list) { Predicate<T> pred = x => x != null; return Enumerable.FirstOrDefault(list, pred);...
Otto asked 25/8, 2014 at 3:45

© 2022 - 2024 — McMap. All rights reserved.