Demystifying Generics in C#

Generics is a great concept in programming languages that was added to .Net 2.0 , it introduces the parameter T to types and methods. Generics improve code reusability, enforces type safety and prevents performance overhead of boxing/unboxing. Continue reading Demystifying Generics in C#


The Difference Between String and StringBuilder in C#

In this article, I will be explaining the difference between using String and StringBuilder when dealing with your string values. and in which cases you should never use String. and other cases where StringBuilder is not the optimal solution. Continue reading The Difference Between String and StringBuilder in C#

Background Worker in C#

The BackgroundWorker is an event-driven way to perform an operation on a separate and dedicated thread. The BackgroundWorker is mostly used when you need to show the user a friendly progress while you are operating a long running process such as downloading files, connecting to database and getting results…etc. The idea behind the BackgroundWorker comes from its name; it processes some operations in the background and any other operation can be performed in parallel meanwhile. Continue reading Background Worker in C#

Single Line Conditional Operators in .Net

>>> Article has moved to Do you know that you can write a nested conditional statement in .net with true and false sides in a single line of code? Yes, this is possible. It can be done using the ternary/binary If operators in and their equivalent operators, the conditional operator  ? :  and the null coalescing operator ?? In additional to the above, and … Continue reading Single Line Conditional Operators in .Net