Design Patterns for Dummies. The Decorator Pattern
Yes there are a lot of posting on design patterns, and you might ask why another of these post on design patterns. I am doing this post so that I can document the design patterns for myself for later use.
There are 23 design patterns as observed by the Gang Of Four (Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides). And they are categorized basically into 3 segments viz. Structural, Creational and Behavioral patterns. I will take these in order.
Read More...Cloning Extension Method
As you know cloning creates a replica of the instance of a type. There are basically 2 ways of cloning. Shallow Copywhich means the original object and the copied object reference the same memory location after the process and Deep Copywhich 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.
Read More...Extension Methods and LINQ
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.
Read More...MPS using VistaDB
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.
Read More...Type Inference, Anonymous types and Lambda Expressions
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.
Read More...