Category Archives: .NET

A better switch with Lambdas in .NET, Part 4 (Working with Types)

By | September 24, 2013

When dealing with the new Switch case constructs, I always wanted to add more to it. After adding things to it like, replacing the previous switch /case with lambdas, then adding a StringComparer and then adding IComparer, I thought let us add something really useful to it. The switch with Types is always one might have wanted with… Read More »

CorruptedStateExceptions in .NET, a way to handle

By | September 23, 2013

It is already a well known fact that while running the MSIL , the CLR (runtime) can generate an Exception object automatically because of some unknown problem it faced while executing the code. These exceptions could be an User mode Exceptions which could have been rose by some bad application code or can also be a Structured Exception… Read More »

How to add Caller Info Attributes to an Environments that doesn’t support it

By | September 20, 2013

If you are building a class library with Retargetable turned on, you might end up your assemblies to be used by some environment that does not support some of the functionality that is well required by the assembly. Let us consider the case with Caller Info Attributes. Caller Info attributes are a good way of determining the name… Read More »

A better switch with Lambdas in .NET, Part 3 (Adding a IComparer)

By | September 13, 2013

Well, after the previous two post, I think you have clearly got an idea on how the Lambda switcher works and even you might have already started applying them in your day to day projects. While, I have shown Equals comparison and one for StringComparison, sometimes, this couldn’t facilitate everything that we need. In this post, I would… Read More »

A better switch with Lambdas in .NET, Part 2 (A StringComparison implementation)

By | September 12, 2013

In my previous post, I have implemented one simple Lambda based switch case which complement the existing switch cases with some additional support of other objects that implements Equals operator in their code. But the implementation that I have provided wouldn’t made you much sense to add in your project or if you are really a fan of… Read More »

A better switch with Lambdas in .NET, Part 1

By | September 11, 2013

I don’t know which programming language you belong to, or which is the best language you have been working on… but one of the best syntax that I think you should be proudly using is the very old switch / case operators. The Switch/case operator gives an clean and clear look on what the code is intended to… Read More »