Taswar Bhatti
The synonyms of software simplicity
Category: .NET
linq

So sometimes you will get these strange errors or exceptions when using Linq Sequence contains no matching element For example if you use

This will throw InvalidOperationException with Sequence contains no matching element. But if you use

Which will return you a null if its not found then you can check if the […]

asp.net

There are tones of blog post out there on how to redirect http to https. As in when a user request for http://myserver.com/Login.aspx they will be redirected to https://myserver.com/Login.aspx One can do it with IIS but I find that way a bit ugly since you have to create another site and set the 403 to […]

design patterns

Null Pattern Last time I blogged about “Learn the Null Pattern“, but I forgot to mention one thing about the Null Pattern. That is you have to be mindful of it. For example

The code looks okay but what if the GetEmployee method actually returns a NullEmployee? Well that would still be okay, since […]

UA-4524639-2