Posts

Showing posts from January, 2017

Dependency Injection (DI)

Dependency Injection (DI) Introduction The dependency injection pattern one of the most popular design paradigms today. It is process of removing dependency of object which creates the independent business objects. It is very useful for Test Driven Development. Background This tip presents an overview of the dependency injection pattern, the different types of dependency injection, and the advantages and drawback of DI with c# source code examples. Scenario of Object Dependency Object dependency means one object needs another object to execute properly, in multitier application (Presentation Tier, Business Logic Tier and Service Tier), the very common scenario is; Presentation Tier dependent on Business Logic and Business Logic requires different services on the basis of end user selection. For instance for Insurance domain, different services could be like ClaimService , AdjudicationService , and PaymentService . If we need some property of Payment service th...

C# Basic

Image
Extension Method in C# Introduction Extension methods are a new feature in C# 3.0. An extension method enables us to add methods to existing types without creating a new derived type, recompiling, or modify the original types. We can say that it extends the functionality of an existing type in .NET. An extension method is a  static  method to the existing  static class. We call an extension method in the same general way; there is no difference in calling. Feature and Property of Extension Methods  The following list contains basic features and properties of extension methods: It is a  static  method. It must be located in a  static  class. It uses the " this " keyword as the first parameter with a type in .NET and this method will be called by a given type instance on the client side. It also shown by VS intellisense. When we press the dot (.) after a type instance, then it comes in VS intellisense. An extension method should be ...