Taswar Bhatti
The synonyms of software simplicity
Category: .NET
dotnet C#

C# Func vs. Action? What is the difference between a Func vs an Action in C#? The main difference is whether one wants the delegate to return a value or not. By using Func it will expect the delegate to return a value and Action for no value (void) 1. Func for methods that return […]

automapper

During the summer I have been busy working on my book “Instant AutoMapper“, and it did get released at the end of July of this year 2013. Here is a link on amazon and packt publishing.

win8

Over the weekend I upgrade to win 8.1 and after upgrade I found my disk usage at 100% and it was getting super slow, plus I only had couple of Gig left on it. The solution I found was to do a disk cleanup, using the cleanupmgr.exe Here are the steps: 1. Use windows key […]

dotnet C#

Lots of developers confuse the var keyword in C# with JavaScript. The var keyword was introduced in C# 3.0, and it is basically implicitly defined but is statically defined, var are resolved at compile time not at run-time. The confusion is there also a var keyword in JavaScript, but in JavaScript var is dynamically defined. […]

linq

Recently I was asked a simple code to improve the performance, and at first I couldn’t see it but as you know your brain starts working when you aren’t thinking of the problem anymore. (It happen to me when I was driving) Anyway the problem on hand was there is a for loop and when […]

linq

Was going through some legacy code recently and found a big for loop that had multiple switch statement inside. So being that I hate something that is fairly large, every method should be small and concise, I went along to refactor it to SRP. This code is generic so you might see something like this […]

linq

Here is some poorly written code that I had to review today and modify (i.e refactor). I have removed the domain of the code and renamed the variables, so that it remains anonymous, but the just of the code is still intact.

Lets go through the inner loop of the code first. First the […]

dotnet C#

Here is a quick way to detect if a text is in Canadian Aboriginal Syllabic in C#. It is just an extension method that would detect if your string is in that range by using regex.

Enjoy.

delegate

Here is a nice little code I did recently, where the Command Pattern is used with a notification observer like pattern. First of the Command Pattern, a simple interface for task with an execute method

Then the notification interface, with 2 methods, one when it started and one when its complete and the event […]

MSSQL

So was hacking a new installer and wanted to display the data link properties dialog, for building a connection string. Here is what I have found out by playing with it. One has to add the reference to ADODB.DLL (from .NET reference) and Microsoft OLE DB Service Component 1.0 Type Library from the COM tab […]

UA-4524639-2