Tag «.NET»

Controlling access to shared resources in an asynchronous world

In my last post I introduced the AsyncLock and AsyncDebouncedFunction.  AsyncLock is a fantastic way of asynchronously holding a ‘lock’ without actually blocking threads.  It is the natural go to class for resource synchronization, but there are alternatives (with caveats). In .Net 4.5 the ConcurrentExclusiveSchedulerPair was introduced, offering a powerful approach to concurrency control.  Using this …

Debouncing asynchronous operations

With the introduction of the async and await keywords, asynchronous programming has finally become achievable by any .Net developer.  Building on the TPL, async and await extend the C# language specification to make task based programming relatively straight forward, and is a huge step forward from APM. However, being able to write code that runs …

Memory Mapped File Performance

In my last post I introduced Memory Mapped Files, and discussed how you could mark them as sparse.  Today, I would like to talk a little about performance.  Using LINQPad (my favourite tool!), I created a rough and ready test script which can be downloaded at the end of the article. The idea was to …

Sparse Memory Mapped Files

Memory mapped files are a powerful addition to the .NET framework in version 4.0.  They’ve been a key part of the windows Operating System since Windows 95, but using them required a working knowledge of COM Interop, as they weren’t exposed directly through the framework.  It’s well worth reading up on them, especially if you’re …

Assembly versioning

Ever since the release of .NET 1.1, there has existed an AssemblyVersionAttribute.  This attribute determines the version number boiled into all .NET assemblies that is (supposed to) indicate something about when the assembly was built. Whenever you create a new C# project in Visual Studio, it helpfully creates an “AssemblyInfo.cs” file (found in the project’s …

Statics and Generics

So statics are generally considered evil, the enemy of TDD and IOC, and at odds with the purity of OO design. Shame they’re so incredibly fast! Whilst we’re talking about the TDD issue, I recommend you stop for a moment and go and take a look at the Fakes Framework added to VS11. Fakes is …