delegates Questions

8

Solved

For properties there are GetGetMethod and GetSetMethod so that I can do: Getter = (Func<S, T>)Delegate.CreateDelegate(typeof(Func<S, T>), propertyInfo.GetGetMethod()); and Setter ...
Ainslee asked 18/4, 2013 at 1:36

4

While investigating this question I got curious about how the new covariance/contravariance features in C# 4.0 will affect it. In Beta 1, C# seems to disagree with the CLR. Back in C# 3.0, if you ...
Christianity asked 13/7, 2009 at 16:47

3

Solved

I don't understand this case: public delegate int test(int i); public test Success() { Func<int, int> f = x => x; return f.Invoke; // <- code successfully compiled } public test F...
Abydos asked 9/3, 2020 at 9:33

6

Solved

Scenario: I have 4 UITextFields that only accept 1 character. Easy. Problem: After I enter the 1 character, I want the next TextField to become active automatically without having to press next (i...
Decease asked 25/1, 2010 at 0:45

6

Solved

I'd like to use the NSFetchedResultsControllerRelegate in a CollectionViewController. Therefore I just changed the method for the TableViewController for the CollectionView. (void)controller:(NSF...
Hearten asked 12/12, 2013 at 21:0

2

In iOS to get the delegate I use following code: AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication] delegate]; How to get the delegate in Cocoa Mac programming?
Phycomycete asked 19/11, 2010 at 6:39

10

Solved

Take the following C# class: c1 { event EventHandler someEvent; } If there are a lot of subscriptions to c1's someEvent event and I want to clear them all, what is the best way to achieve this?...
Throughway asked 30/9, 2008 at 15:32

2

Solved

I'll try to make this as clear as possible. A Plugin architecture using reflection and 2 Attributes and an abstract class: PluginEntryAttribute(Targets.Assembly, typeof(MyPlugin)) PluginImplAttr...
Colt asked 19/1, 2020 at 21:21

1

How can I write code below in java version? I have read similar questions, but they are confusing, they answered that java didn't have delegate feature like c# had, in other hand they answered wit...
Designed asked 6/1, 2020 at 2:57

3

Solved

I am delegating a couple of methods and also want them all to be private. class Walrus delegate :+, :to => :bubbles def bubbles 0 end end I could say private :+, but I would have to do t...
Ronnieronny asked 26/3, 2013 at 17:4

6

Solved

I am making an object that goes to download stuff for all of my view controllers. The object is singleton instance and has a callback method with received data once the download is completed. It al...
Tanberg asked 8/10, 2012 at 3:4

3

Solved

I read that If you are using multicast delegates, you should be aware that the order in which methods chained to the same delegate will be called is formally undefined. You should, therefore,...
Angeles asked 30/6, 2014 at 7:14

1

Solved

I am currently using this code to attempt to dynamically execute a saved Func<object>: public async Task<object> GetFuncResult(string funcName) { Func<object> func = _savedFuncs...
Aspirator asked 28/11, 2019 at 0:30

6

Instead of using an application delegate so that the UIApplication singleton can call the delegate methods at predefined time, what are the advantages and disadvantages of just subclassing UIApplic...
Flowerless asked 26/5, 2012 at 4:47

3

Solved

TLDR: Is there a Java equivalent of C#'s delegates that will allow me to queue up methods of various classes and add them to the queue dynamically? Language constructs instead of the code for it. ...
Gib asked 6/9, 2016 at 10:9

12

Solved

Clicking in a textfield makes the keyboard appear. How do I hide it when the user presses the return key?
Annihilation asked 26/8, 2010 at 9:52

2

I'm using UIDocumentPickerViewController to select documents from the Files and upload it to a server. I'm able to successfully access Files, but upon clicking on the file the delegate method doesn...
Solano asked 15/8, 2018 at 6:56

4

Solved

I know Events are always associated with Delegates. But, I am missing some core use of Events, and trying to understand that. I created a simple Event program, as below, and it works perfectly fin...
Eyehole asked 3/3, 2013 at 5:37

4

Solved

I have a class that retrieves JSON from a URL and returns the data via the protocol/delegate pattern. MRDelegateClass.h #import <Foundation/Foundation.h> @protocol MRDelegateClassProtocol ...

3

Solved

Can someone explain when and when not to use a 'weak' assignment to a delegate pointer in Swift, and why? My understanding is that if you use a protocol that is not defined as a class you cannot,...

2

Solved

With D, how can I pass a function (possibly reference to a function) as an argument to be executed inside other function? import std.stdio : writeln; class Event {} class EventTarget { void addE...
Walkin asked 4/10, 2019 at 6:46

5

Solved

I want to test that setting a certain property (or more generally, executing some code) raises a certain event on my object. In that respect my problem is similar to Unit testing that an event is r...
Ackley asked 2/4, 2010 at 14:11

2

Solved

How do I pass a function pointer from managed C++ (C++/CLI) to an unmanaged method? I read a few articles, like this one from MSDN, but it describes two different assemblies, while I want only one....
Ophiolatry asked 4/6, 2010 at 8:13

3

Solved

How is it possible that this code TaskManager.RunSynchronously<MyObject>(fileMananager.BackupItems, package); causes a compile error The call is ambiguous between the following methods o...
Monastery asked 10/9, 2013 at 10:4

2

Solved

I'm passing a System.Action as a parameter to a method which does some lengthy operation and want to add more stuff to the invocation list after the Action has been passed: class Class1 { private...
Ampersand asked 28/8, 2019 at 17:49

© 2022 - 2024 — McMap. All rights reserved.