Category Archives: .NET

Detecting code smells with NDepend

I recently had the opportunity to play again with NDepend. From my experience in many companies the developers, even if they find NDepend useful, don’t push enough the management to buy it, for various reasons: ‘we have free/built-in similar tools’, … Continue reading

Posted in .NET, Code Quality, design | Tagged , , , , , , | Leave a comment

When the length of a database field can be misleading

The length of a database field, at least on MS SQL Server, is not what many people think it is. Let’s say that I have a 10 character field: nvarchar(10): Surely we can insert a row with 5 chars in … Continue reading

Posted in .NET, SQL Server | Tagged , , , , | Leave a comment

Debugging a performance issue in production

One of the projects I’m working on has a component that has a very simple task: reads a record from a database table and based on it, send a message to Microsoft Windows Service Bus. Then the next record is … Continue reading

Posted in .NET, Entity Framework | Tagged , , , , | 4 Comments

NameOf and Obfuscators

I was wondering some time ago how the new ‘nameof‘ operator from C# 6.0 works when using .. obfuscators. Let’s write some code to verify this. I included a few other methods to get the member name (VS2015 RC was … Continue reading

Posted in .NET, C# | Tagged , | 1 Comment

Patterns and frameworks

Many people, when they first start to study design patterns (usually in university), dive into the ‘Gang-of-four’ reference book and if they have the energy to read it all, in the end they think something like: ‘well, very cool and … Continue reading

Posted in .NET | Tagged , , , , | 1 Comment

On closures and captured variables

A few days ago, on the project I’m working on, I’ve stumbled on an interesting bug – an example of why it pays off to learn the ‘deeper’ areas of C# language (or any other language). Greatly simplified (and with … Continue reading

Posted in .NET, C# | Tagged , , , | Leave a comment

On assumptions and formats

In .NET (and any other framework for that matter), it’s better to never assume anything, but to check twice. Let’s take an example – what do you think, will the following unit test always pass? . . . . . … Continue reading

Posted in .NET, C# | Tagged , , , | Leave a comment