The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
49 views

Refactoring Java transmitter delegate implementation

I have 3 classes: a transmitter, a view for displaying and a recording view for flushing the screen contents into a file. The view and the recording view classes register themselves from their ...
1
vote
1answer
40 views

Possible memory-leak on a self-removable event handler

A friend of mine asked me a question recently. He was needed to subscribe to an event of some object (window button click) and unsubscribe from it on a first call of a handler. Also he noticed that ...
1
vote
1answer
163 views

Using delegates to communicate between forms and networkcommunicator class

I'm trying to develop an application in c# i currently have a code similar to the one attached below. Basically what it does is: Having multiple form, each of which would like to send message through ...
1
vote
1answer
75 views

Putting called delegate into AsyncState parameter - Pros/cons?

I have the following interface: public interface ILogger { void Log(string message, string title, StatusType type, DateTime timestamp); IAsyncResult LogAsync(string message, string title, ...
4
votes
2answers
205 views

Generic Wrapper for a Task-based API

I've written a piece of an ugly code. The idea was to provide a clear-looking, type-inferring framework to test a task-based API (it's for integration testing, and test methods should be as clear as ...
1
vote
1answer
126 views

Delegate optimizations

I wrote simple delegate in C++11 for my GUI project. I think that some parts can be optimized or cleaned. #ifndef DELEGATE_H #define DELEGATE_H //Container interface template<typename... Args> ...
7
votes
1answer
252 views

using <T> in generic delegates?

Here is my problem. Do I need to give a new identifier to each delegate I write of the following delegate type? like so: or could i use one delegate that accounts for any Datatype I need to use so i ...
4
votes
2answers
158 views

How to simplify these delegate functions?

I'm looking for a way to simplify this code, because I could develop more overloads for TryThis I made the string and int both of class Nullable so that in each overloaded function, the catch block ...
3
votes
1answer
150 views

Cancelable thread worker

My goal was to create class, that can run external method in non blocking manner. Second requirement was to be able to abort method run if it is needed (i.e. running user script). I decided to do that ...
2
votes
1answer
102 views

Is it correct to use delegates as properties?

I need to create a class with two properties: LogOutput ExceptionOutput These properties (of type Action) send a message or a exception depending on the target function. This target function is ...
1
vote
1answer
1k views

Polling loop to run in a background thread

I came up with the idea of a small utility class that will poll some delegate until the response received meets some condition, upon which it will notify the main thread which can take the appropriate ...
2
votes
0answers
396 views

WeakAction Implementation

Here's my first attempt at creating a WeakAction using Expressions and Delegates. I would like it to be clear that this code was written after reading serveral blogs and taking snippets from various ...
3
votes
3answers
535 views

Is this code OK, to thread safety and delegates?

I've created some code, in main class loop are generated numbers (0~100), and when is generated number > 20 its value is passed to the thread where is simulated some work with this number. Meanwhile ...
3
votes
3answers
382 views

Improve my Task Loops

How can I improve up this code? Is it ok to write code using Invoke and Action so liberally or is this bad? Performance is not an issue as I'm not using Invoke 50,000x in a a row (a lot of other ...
2
votes
1answer
269 views

Anything I'm missing on this delegate implementation?

Just as the question states and to be sure, am I missing anything on this? Something important/obvious that I overlooked? As is, I can save any functor, function pointer and member function pointer ...