Tag Archives: csharp

How exception filters can help you investigate runtime errors in C#

By | July 2, 2016

Exception filters are not new. Its been there for a long time (at least for than a year) as it is been released with .NET framework 6.0. But I do see developers don’t know the basic advantages of using exception filters and use code inside catch to determine problems. Let us look how exception filters can help you… Read More »

Back to Basics – Calling base class constructor from derived class in C#

By | May 13, 2015

How to call base class constructor from derived class ?  Another frequently  asked question in interview for the beginners, and I have seen confusion around answering this. Let’s have a quick understanding on this. If we derive a class from a base class and want to pass data from the derived class constructor to the constructor of the… 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 »

The String Intern Pool

By | February 12, 2012

String forms a large part of a program. Irrespective of what the program is used for, almost 70% of the actual program code (approx) is generally formed by strings. As we all know .NET strings are immutable. Producing large number of string constants inside a program or assigning same string to more than one objects can eat up… Read More »

Automate Assembly Build Version

By | October 16, 2011

It is the most common requirement to many of us to show the proper assembly version and build version to our application. Now for every version you can either choose your assembly version yourself, or rather you try to find some alternative that Visual studio automatically increments the value of your Build version and/or assembly Version. In this… Read More »