Visual Studio 2012 Intellisense Not Working - SOLVED

So, this post is about our beloved IDE instead of actual code. I recently upgraded my home PC from Visual Studio 2010 and 11 Beta to Visual Studio 2012. The very first thing I noticed was that after about 10 minutes of programming my Intellisense quit working and never came back. I thought to myself “what the hell Visual Studio? 2010 didn’t have these problems?!” and then, after a swig of beer, proceeded to exercise my Google-Fu to solve this issue. [Read More]

Static vs Instance string.Equals Benchmark

A friend of mine commented on my last post asking about how much faster the static string.Equals method is than the instance string.Equals method. To satiate both of our curiosities, I have created this benchmarking application: static void Main(string[] args) { var stopwatch = new Stopwatch(); string a = "hello"; string b = "hi"; stopwatch.Start(); for (int i = 0; i < 10000000; i++) { a.Equals(b); } stopwatch.Stop(); Console.WriteLine("Instance string.Equals over 10,000,000 iterations: " + stopwatch. [Read More]

Static vs Instance string.Equals

As you may or may not know, static methods are usually faster than instance methods. This alone should be a good enough reason to use the static string.Equals methodin .NET, but if that doesn’t do it for you, allow me to present a simple example. string a = "hello"; string b = "hi"; bool result = a.Equals(b); What is the expected result of these lines? A boolean value of false, of course. [Read More]

The Joel Test Really is Meaningful

Well, it’s been nearly 2 months since my last post… I’m learning that if you want a blog to be successful, you have to carve time out of your busy life and make it happen. So, with renewed focus, I re-enter the fray. The Joel Testis a curious and honest thing. It has been around since the year 2000 and was invented by a guy named Joel Spolsky, as the name might imply. [Read More]

Published by MDSN UK Blog

This isn’t a very technical post, but I was published by Microsoft recently via their MSDN UK Blog! The article is on creating and maintaining a successful User Group.

Click here to read the article!

TPL and Error Handling & Continuation Tasks

Two of my colleagues (one from work and one from a user group) kindly pointed out to me that in my last post I omitted Continuation Tasksas a means of Error Handling for the TPL. As such, I will expand upon my last post with an example of handling errors via a Continuation Task. Continuing where we left off last, the following code will utilize a Task Continuation to handle errors within Tasks. [Read More]

TPL and Error Handling

As of .NET 4.0, the TPL or Task Parallel Library is king when it comes to parallelization. It allows for smooth, easy multi-threading for any application. There is a slight learning curve, however, and a major part of this is understanding how Exceptions bubble-up while using the TPL. Let’s partake in a simple example. This code will create and run a task that throws an Exception, and then attempt to catch it: [Read More]

Compiler Tricks - Inferred Types

The .NET compiler is a terrific thing… After all, it turns your C# into an executable program! One nice feature of the .NET compiler, which is becoming better each release, is inferred typing. I’d like to lay out a few short examples that might help you develop your programming standards and practices. Inferring a type when creating an array. // Create and initialize an array var myArray = new int[] { 1, 2, 3 }; Becomes: [Read More]

Custom Output Caching with MVC3 and .NET 4.0 - Done Properly!

I came across a need at work today to re-implement some of the Output Caching for our MVC3 application which runs under .NET 4.0. I wanted to use standard Output Caching (via the OutputCacheAttributeclass, why re-invent the well-working wheel?) but due to some of our requirements I needed more control over how my objects were cached. More specifically, I needed to cache them with a custom Cache Dependency. With a little bit of Google-Fu, I was delighted to learn of the Output Cache Provider functionality introduced in ASP. [Read More]

LINQ and Deferred Execution

As of .NET 3.0, LINQ (and the often related Lambda Expressions) have been available for our use and abuse. LINQ stands for Language INtegrated Query, and is a method of modelling OO data in a more or less relational sense that is not unlike databases. And just like databases, it comes with a cost. To offset this cost, LINQ uses Deferred Execution. Deferred Execution means that the code is not executed until it is needed. [Read More]