Home
Gallery
GuestBook
SourceCode
Contact

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.

...


MPS using VistaDB

Posted in VistaDB
This post has been read 334 times
Abstract:

As promised in my previous post on VistaDB providers, I have implemented the VistaDB provider for my website. The full source code is available here. Note : I did this in a hurry and I might have missed out on some things. Please feel free to send feed back on this.

...


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.

...




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