Threading – Producer-Consumer Pattern

Having run into a bit of deadlocking issue while working on Bingo.Net I spent a bit of time reading into the Producer-Consumer pattern and here’s what I learnt which I hope you’ll find useful too. AutoResetEvent and ManualResetEvent To start off, MSDN has an introductory article on how to synchronize a producer and a consumer …

Threading – Producer-Consumer Pattern Read More »

Threading – when to use Monitor.Pulse and Monitor.PulseAll

Ever wondered when you should use Monitor.Pulse and when you should use Monitor.PulseAll given that only one thread will be able to acquire the lock even if you wake up multiple threads? I did, and that’s when I stumbled across a similar question on StackOverflow and as ever, Jon Skeet came up with a really …

Threading – when to use Monitor.Pulse and Monitor.PulseAll Read More »

Threading – understanding the volatile modifier in C#

Whilst working on Bingo.Net I have come across a number of concurrency issues which must be fairly common in synchronous multiplayer games. During my attempts to overcome these obstacles I came across the volatile modifier in C# which at first glance looked like a silverbullet for all concurrency problems, but under closer inspection it more …

Threading – understanding the volatile modifier in C# Read More »

.Net Tips – use DebuggerStepThrough attribute

When debugging your application, don’t you just get annoyed that pressing F11 keep taking you into the get method of the properties (auto-properties excluded!) passed into the method rather than the method you want to step into? I use auto-properties wherever possible because they’re syntactically cleaner and have less maintenance overhead, and I have the …

.Net Tips – use DebuggerStepThrough attribute Read More »

.Net Tips – using configSource or file attribute to externalize config sections

There’s a little known attribute which was introduced in the .Net framework 2.0 called configSource, which allows you to externalize sections of the configuration file. It works just like the optional file attribute found on the appSettings element: <appSettings file = “relative file name” /> but can be added to any configuration section to specify …

.Net Tips – using configSource or file attribute to externalize config sections Read More »

Functional programming with Linq – Enumerable.Range

In my Learning F# posts you probably saw how you can generate an int array like this: this returns 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. This is pretty cool, and fortunately, you have something very similarly in C# with Enumerable.Range which you can use by supplying a starting number and a …

Functional programming with Linq – Enumerable.Range Read More »

Rx framework – IObservable<T>.Repeat

Having looked at a number of extension methods in Rx which allows you to combine two observable collections in some way, namely: Zip Merge CombineLatest Concat Catch OnErrorResumeLast There are also extension methods which allow you to repeatedly subscribe to the same observable collection, the suitably name IObservable<T>.Repeat method. If the repeated observable collection is …

Rx framework – IObservable<T>.Repeat Read More »

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.