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 ...
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...
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?
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?...
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...
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...
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...
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,...
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.
...
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...
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
...
Baklava asked 27/6, 2013 at 16:31
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,...
Thor asked 5/5, 2015 at 14:58
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...
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...
© 2022 - 2024 — McMap. All rights reserved.