Tuesday, November 13, 2012
Enable SPA in VS 2012
SPA template has been deliberately removed from the last beta and the RC releases of Visual Studio 2012. But now it's back on track.
http://www.asp.net/vnext/overview/fall-2012-update
Saturday, August 11, 2012
Extension Methods
Extension methods allows you to add methods to existing types without creating any derived type. So we don't have to modify the original type.Extension methods are special kind of static method, but they can called as instance methods on the extended type.
Extension methods are only in scope when you explicitly import the namespace in to your source code with a using directive.
- Extension class and the extension method should be static.
- The first parameter specifies which type the method operates on.
- The first parameter is preceded by the this modifier.
Extension methods are only in scope when you explicitly import the namespace in to your source code with a using directive.
Extension Methods for Existing Types
Below extension method has written for the string type.
You can invoke the extension method as a instance method or a static method.
Extension Methods for Classes
In the below code I have write a interface. But without changing the current implementation I'll add a Extension class. By doing so, we can call the extension methods which are like members of the interface.
Extension Methods for Lambda Expressions
Extension methods can be used for the LINQ/Lambda expressions. Below I have created some extension methods for the List<Student>.
Tuesday, July 31, 2012
Decorator Pattern
Decorator Pattern adds additional attributes to an object dynamically.
Picture frame would be a example. The picture is an object which has own attributes. But for the display purposes we add a frame, in order to decorate it.
In programming world, Decorator pattern is about the wrapper objects. The definition is, "Allows for the dynamic wrapping of objects in order to modify their existing responsibilities and behaviors"
Picture frame would be a example. The picture is an object which has own attributes. But for the display purposes we add a frame, in order to decorate it.
In programming world, Decorator pattern is about the wrapper objects. The definition is, "Allows for the dynamic wrapping of objects in order to modify their existing responsibilities and behaviors"
We'll create an ice cream application, Vanilla/chocolate ice cream will be decorated with almonds/honey.
Create an interface which contains the MakeIceCream functionality.
We need to decorate that vanilla/chocolate ice cream. This should happen without effecting the existing class structure.
Subscribe to:
Posts (Atom)














