Home
Gallery
GuestBook
SourceCode
Contact

Structural Design Patterns

Posted in C#
This post has been read 1090 times
Abstract:

In the previous few posts I have been writing about design patterns and for now I have completed the structural patterns as described by the GOF. Below are the links to all the structural patterns.

...


Cloning Extension Method

Posted in C#
This post has been read 441 times
Abstract:

As you know cloning creates a replica of the instance of a type. There are basically 2 ways of cloning. Shallow Copy which means the original object and the copied object reference the same memory location after the process and Deep Copy which means the original object and the copied object do not reference the same location after the process. You can shallow copy the object by using the protected MemberwiseClone method of the object. You can implement the Clone method of the ICloneable interface for each class you have to clone for the deep copy. I somehow did not like the idea of implementing this Clone method in each and every class that I wanted to clone, so I created a generic class  to get the deep cloning working. Here is the code.

...


Extension Methods and LINQ

Posted in C#
This post has been read 342 times
Abstract:

This is the final post about the new features in C# 3.0. You can read the first two posts here and here. In these posts I have just described the new features of C# 3.0 without going much into details. If time permits I will elaborate on each of these.

Extension Methods

Prior to C# 3.0, the only way to update member information of a compiled type, was to recode and recompile the code. But now with extension methods we can allow compiled type to obtain new functionality. This is immensely helpful  when you want to add functionality to a third party type where you are not allowed to change the code. When you create an extension method, it actually behave as if it was part of the original type. Lets see an example.

...


Type Inference, Anonymous types and Lambda Expressions

Posted in C#
This post has been read 377 times
Abstract:

This is the second of posts about the new features in C# 3.0. You can read the first post here. Well this was long overdue, but anyway, here it is.

Type Inference

When we are using type inference which was introduced in C# 3.0, the compiler determines the type of the variable at compile time. Here is an example of type inference.

...


Automatic Properties and Object Initializers

Posted in C#
This post has been read 529 times
Abstract: Automatic Properties

In this post we will look at some of the new features added in C# 3.0. The first of these will be automatic properties. Automatic properties gives us with a shorthand notation for defining a new property...




Subscribe

Random Photo

My Tweets


Top Posts

Source Code

The source code to this site is open-source. You can download the code from here.

Categories


Recent Blogs


Archives


Blogroll