2022 Developer Survey is open! Take survey.
14 votes
Accepted

A new approach to multithreading in Excel

Interesting idea and well-done! Naming I really don't like the names. The names like clsMultiThread is somewhat misleading, since as you noted they don't actually ...
user avatar
  • 2,009
13 votes
Accepted

Simple Async Google Maps initializer with AngularJS

I like it, you could clean up the commented out code and possibly replace $window.googleMapsInitialized = function () { mapsDefer.resolve(); }; ...
user avatar
  • 32.4k
13 votes
Accepted

Implementing an asynchronous mutex in C#

A better alternative to the busy wait loop would be to use a Semaphore - in this case a SemaphoreSlim would probably be the most appropriate. Semaphores are not ...
user avatar
  • 20k
13 votes
Accepted

Asynchronous TCP server

This is an ugly old pattern. Why don't just try the newer async/await? You already use Task in your tests anyway. In order to ...
user avatar
  • 43.8k
12 votes
Accepted

Calling synchronous code in asynchronous method

If it's really just removing an item from a dictionary (and not e.g. doing synchronous file IO), then Alternative 1 is the best. When you're using async for scalability (e.g. in ASP.NET), using ...
user avatar
  • 24k
11 votes

Script to enter text in a box

Rather than using System Events to generate keystrokes, consider using TextEdit itself to insert text. ...
user avatar
11 votes
Accepted

A ViewModel using ReactiveUI 6 that loads and sends data

Sorry to disappoint, but you did everything right! This is a quite good example of using RxUI, Akavache, and Refit together. The only thing I would change, is to not immediately call ...
user avatar
  • 356
10 votes
Accepted

Running 2 sets of tasks at the same time

When I have to manage multiple threads, I make sure all processing is complete, typically by using WaitAll. ...
user avatar
  • 335
10 votes
Accepted

Running Code Just Once

There are a few items to make this code better. Naming. Once is an OK name for the class, but the method name IsDone is a problem. This is an 'atomic' operation ...
user avatar
  • 96.7k
10 votes
Accepted

Generic asynchronous SQLite search builder

Reflection is slow. That line probably doesn't help your performance : var model = (T)Activator.CreateInstance(typeof(T)); I notice that you always create your ...
user avatar
  • 12.2k
10 votes

Asynchronous Circular Buffer in C#

Quick Review An API like this, dealing with thread-sensitive operations, requires time and effort to test and review rigorously. When I will find this time, I will do a thorough review. But here are ...
user avatar
  • 13.8k
8 votes
Accepted

Non-blocking, non-threaded HTTP client implementation

Have you considered using HttpClient class from .Net 4.5+? That makes your code lot cleaner. Also why not take Async pattern all the way? From your initiator (button click or main etc) you can call ...
user avatar
  • 298
7 votes
Accepted

Verifying the type of an AggregateException's inner exception in a unit test

I am blocking the call using AsTask().Result, is this the most appropriate method? Can't you use await? Most testing frameworks ...
user avatar
  • 24k
7 votes

Script to enter text in a box

Assuming that you want to stick with the original plan to insert text wherever the cursor happens to be, you would need something more deterministic than an arbitrary delay. This script covers all ...
user avatar
7 votes
Accepted

Asynchronous method and collection binding

First, I want to point out the behavior of method that is declared as async void. When the code reaches this line: ...
user avatar
  • 211
7 votes
Accepted

Asynchronous HTTP JSON request

I know this is technically outside the scope of the review here, but your first parameter's type is Method. This enum desperately needs to be renamed. When I see <...
user avatar
  • 25.2k
7 votes
Accepted

Getting messages asynchronously using MailKit

It's hard to say how to write the ideal method for your use-case because you don't specify some of the details that would be necessary to know, such as: How often will your code be making this query? ...
user avatar
  • 186
7 votes
Accepted

Closing SQL connection for async operations

No that isn't right. If your query throws an error you won't be closing the connection. Swallowing exceptions like that (even though you're logging it) is generally bad as well. How does the user know ...
user avatar
  • 16.6k
7 votes
Accepted

Login UI for an Android app

Using an AsyncTask instead would be much better. You've got many callbacks to the UI thread, all of this you could do in the post execute method instead: ...
user avatar
  • 355
7 votes
Accepted

WPF Mvvm async function ViewModel

General Your model should not return an ObservableCollection because that collection should be used only if its change notification ability is needed (e.g. with ...
user avatar
  • 8,498
7 votes
Accepted

Using SendAsync to send multiple emails

From the SendAsync docs: After calling SendAsync, you must wait for the e-mail transmission to complete before attempting to send another e-mail message using Send or SendAsync. So no, this ...
user avatar
  • 30.7k
7 votes

A new approach to multithreading in Excel

This is way above my expertise, but maybe adding an answer would cause more views/answers? Also, what's that beginner tag doing there? ;) I want to say first off, really solid work. That's probably ...
user avatar
  • 7,099
7 votes

Monitor asynchronous tasks, tracking their running times

Ugly typedef I'm not a big fan of this: typedef std::future<int> FutureResultInt; It's not significantly shorter or easier to read, it doesn't isolate the ...
user avatar
  • 57.8k
7 votes
Accepted

C# asynchronous notification vector

I don't think that screen space is so limited that methods can't be separated by a blank line, and separation makes it slightly easier to see scope. ...
user avatar
7 votes

Action queue manager to perform action in a FIFO fashion

EnqueueAction may want to throw an ObjectDisposedException if the queue is disposed, depending on the precise API you want. I ...
user avatar
  • 7,086
6 votes

Calling many web services asynchronously

I'm not all that familiar with async/await (I really need to get going on this), but I find your code pretty clear, except why ...
user avatar
6 votes

Calling many web services asynchronously

SemaphoreSlim implements IDisposable and should be disposed of, preferably using the using ...
user avatar
  • 16.1k
6 votes

Calling many web services asynchronously

The fact that the lambda you're passing to Task.Run is async, along with the comment, implies that the work being done is not ...
user avatar
  • 791
6 votes
Accepted

First time trying async

There isn't much to review here, but I would probably have introduced a variable for the awaited call's result, and then used a ternary to determine the ...
user avatar
6 votes

First time trying async

you should make use of newlines and the fact that C# is semi-colon terminated right here ...
user avatar
  • 28.5k

Only top scored, non community-wiki answers of a minimum length are eligible