Overview of C# 3.0 Anonymous Types

Microsoft introduced some great new features in C# 3.0 to make developers more productive. Most of those features are introduced to support Language Integrated Query (LINQ) but they can also be used in many other scenarios. One such feature is Anonymous Types that allows you to define a class with some simple encapsulated fields without any associated methods, events or functionality. In this tutorial I will give you overview of C# 3.0 Anonymous Types.

Read Full Tutorial

Advertisements

Overview of C# 3.0 Object Initializers

When you create object of any type in C#, it is very common to call its default constructor using new keyword and then set the object properties one by one. The new object initializer syntax introduced in C# 3.0 makes it easier for us to initialize our objects in one statement without calling the object parameterize constructor. In this tutorial I will give you an overview of this new Object Initializer feature of C# 3.0.

Read Full Tutorial

Understanding C# 3.0 Extension Methods

As you know, once a type such as class, interface, and structure is defined and compiled into a .NET assembly, it is not possible to add new members or update existing members without opening and changing the source code and recompiling it again. In C# 3.0, Microsoft introduced a new feature called Extension Methods that enable developers to add new functionality to existing precompiled types. These types can be either .NET Framework built in types such as String and DateTime or they can be your custom types. In this tutorial I will try to give you a complete overview of extension methods.

Understanding C# 3.0 Extension Methods

Read Full Tutorial

Overview of C# 3.0 Automatic Properties

All .NET programming languages prefer the use of Properties to encapsulate the private fields available in the class. There is nothing too problematic with Properties but sometimes when you need properties simply to assign and return the value stored in a private field it looks quite a lot of work especially if you have to declare properties for 15 to 20 private fields. To automate the process of providing simple encapsulation of field data C# now has a new syntax to generate automatic properties. In this tutorial I will show you how you can create Automatic Properties and how you can use them in your programs.

Read Full Tutorial

Implicitly Typed Local Variables in C# 3.0

Microsoft introduced quite a number of new features in C# 3.0 and later version and most of them are added in the language to support another new technology LINQ. One of those features is implicitly typed variables that allow you to create a local variable by using a newly added var keyword without giving it a specific type. In this tutorial I will give you introduction of implicitly typed variables and their use in your programs.

Read Full Tutorial

Overview of .NET Framework Specialized Collections

Collections are classes that programmers use to group and manage related objects just like Arrays. However unlike Arrays collections are dynamically resizable objects which means they automatically grow and shrink as you add, insert or remove objects and you don’t need to worry about its size. In this Tutorial I will give you overview of some of the specialized collections available in System.Collections.Specialized namespace.

Read Full Tutorial

Singleton Design Patten in C#

The singleton pattern is one of the most known and easiest design patterns in software engineering. In simple words, a singleton is a class which only allows a single instance of itself to be created. There are various different ways to implement this pattern in C#. In this tutorial, I will show you how you can implement the singleton design pattern with minimum amount of code.

Read Full Tutorial