Taswar Bhatti
The synonyms of software simplicity
Tag: csharp
dotnet C#

From the C# documentation it states that the @ symbol is an Identifier. 2.4.2 Identifiers The prefix “@” enables the use of keywords as identifiers, which is useful when interfacing with other programming languages. The character @ is not actually part of the identifier, so the identifier might be seen in other languages as a […]

bom

Was detecting a file stream if it was Unicode encoded or not, so though I would share the code. Let say you an xml file that you need to detect if it has the Unicode BOM in the file. If you wish to know more about BOM look it up at wikipedia

Hope that […]

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 […]

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 […]

UA-4524639-2