Hello,
Supposing I have a single class, containing a simple method. Let's say that there is a delegate with the same signature as this method.
I want to run multiple long-running processes, each one launched from this class. Each process contains an event, which is composed of multicast delegates of the same type as the delegate mentio...
Is there any special support when you come to test callbacks with NUnit? Or some kind of of "best practice" which is better than my solution below?
I just started writing some tests and methods, so I have still full control - however I think it might be annoying if there are better ways to test callbacks thoroughly, especially if comple...
The LDC D compiler for LLVM can inline indirect function calls under some circumstances if it can prove that the target is statically known. Here's a toy example (in D) of where this might happen:
void main() {
uint num;
void incNum() {
num++;
}
auto myDelegate = &incNum;
myDelegate();
}
In this case, ev...
Hallo Everyone,
with the iOS 4, the iPhone is supporting Multitasking, what is very nice, but something I do not wish to support in my Application. I mean, when the user press the Home-button, I want my application to finish and not to enter in Background. With the iOS 4, when the User press the Home-button, the App calls the applicatio...
Hi All,
How to know how many event handlers for an event?
I want a way to execute the following code:
// if (control.CheckedChanged.Handlers.Length == 0)
{
control.CheckedChanged += (s, e) =>
{
// code;
}
}
Note: this code is out side the control class.
Thanks in advance.
...
We have a .Net object that has a static delegate (a data access strategy) that has to be set before the object can be instantiated. The delegate can also be passed in through one of the constructor overloads.
I have another object that has the delegate that I need to set, but I can't figure out in PowerShell how to do so. Does anyone ...
When you call the BeginInvoke method on a Func delegates (or the Action delegates for that matter) in C#, does the runtime use the ThreadPool or spawn a new thread?
I'm almost certain that it'll use the ThreadPool as that'd be the logical thing to do but would appreciate it if someone could confirm this.
Thanks,
...
I have my UIPopoverController with self as a delegate:
I receive calls when I tap outside the popover controller, but when I tap inside I want to dismiss too, so I use -dismissPopoverAnimated: but delegate is not called in this case.
Is this normal? Is this a bug or I am doing something wrong?
newDocPopoverController = [[UIPopoverContro...
Possible Duplicates:
When would you use delegates in C#?
The purpose of delegates
I have seen many question regarding the use of delegates. I am still not clear where and WHY would you use delegates instead of calling the method directly.
I have heard this phrase many times : "The delegate object can then be passed to code ...
Hello,
I wonder when I should use Core Data and when I just should keep it easy and use delegate variables?
...
I'm curious what delegates methods exists? For instance I'm aware of Asynchronous method calls, like this:
class Program {
// define a delegate
delegate int MyDelegate(String s);
static void Main(string[] args) {
// create the delegate
MyDelegate del = new MyDelegate(myMethod);
// invoke the method asynchron...
I have a request that contains a batch of "tasks" that need to be completed. An "asyncstate" object that gets passed around via both the request/response contains a collection of "PendingTasks" and "CompletedTasks". Once a task has been complete by a request handler, it gets moved into a "CompletedTasks" collection. If the original re...
I am working with System.Func but have reached a stumbling block with it.
System.Func<TReturn> // (no arg, with return value)
System.Func<T, TReturn> // (1 arg, with return value)
System.Func<T1, T2, TReturn> // (2 arg, with return value)
System.Func<T1, T2, T3, TReturn> // (3 arg, with return value)
System.Func<T1, T2, T3, T4, TReturn>...
What are the implications of doing this...
this.myButton.Click += new EventHandler(this.myButton_Clicked);
...versus this?
this.myButton.Click += this.myButton_Clicked;
I suspect that the compiler is creating a new instance for me in the second example. I'm sure this is a bit of a newbie question, but Google didn't turn up anything...
I have an appdelegate(.h,.m) and two view controllers - loginviewcontroller, searchviewcontroller
On loginviewcontroller I have userid and password fields and login button.
once login is verified searchviewcontroller view will be shown.
I have loginsuccess function defined in appdelegate and it is being called from loginviewcontroller....
I'm using reflection to grab a field that happens to be a delegate. I need to replace this delegate with my own, but the type of the delegate is private (so I can't create it from my method and assign it)
I have a delegate type with an exactly matching signature, so is there some way I can dynamically cast my delegate to this other type...
I have a LINQ query, and I want to have a delegate that I can assign the "OrderBy" or "OrderByDescending" methods to. The signature of the "OrderBy" extension method is:
public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(
this IEnumerable<TSource> source,
Func<TSource, TKey> keySelector)
Can anyone show me what...
I have this lambda expression Expression<Func<bool>> commandToExecute
Then I pass an instance of a class in there with a method:
_commandExecuter.ProcessCommand (() => aClass.Method())
How do I get the instance of aClass within the ProcessCommand method?
I want to execute some addiontal methods of this class or get some property va...
As the code shows below, I'm creating a thread in a foreach loop and running them at a later time, however when I run the thread I get the "object reference not set to an instance of an object" error. I suspect this is a closure problem, but it seems like i'm doing everything i should be to avoid that here by creating a local copy of th...
Possible Duplicate:
Compilation fails if delegate definitions is put in another project?
Using .NET 3.5 SP1 and Visual Studio 2008
Projects A and B, both class libraries, A uses B
In project B i have the following:
public delegate void MyDelegate(object o1, EventArgs o2);
public delegate T MyUberDelegate<T>(MyDelegate myDele...