Click here to Skip to main content
11,804,008 members (75,862 online)
Click here to Skip to main content
Add your own
alternative version

Dependency Injection Frameworks - Part 1 - Introduction

, 12 Jun 2008 CPOL 49K 584 64
An introduction to the dependency injection design pattern and frameworks, illustrated by a simple example.
using System;
using Spring.Context;
using Spring.Context.Support;

namespace SpringDotNETExample
    public interface ISayHello
        String SayHello { get; }

    public class WorldSayHello : ISayHello
        public string SayHello
            get { return "Hello Friend!"; }

    class Program
        static void Main(string[] args)
            IApplicationContext ctx = ContextRegistry.GetContext();
            ISayHello hello = (ISayHello)ctx.GetObject("ISayHelloInterface");

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ashish Kaila
Software Developer (Senior) MixModes Inc. | Research In Motion
Canada Canada
Ashish worked for Microsoft for a number of years in Microsoft Visual Studio (Architect edition) and Windows Live division as a developer. Before that he was a developer consultant mainly involved in distributed service development / architecture. His main interests are distributed software architecture, patterns and practices and mobile device development.

Currently Ashish serves as a Technical Lead at RIM leading next generation BlackBerry media experience and also runs his own company MixModes Inc. specializing in .NET / WPF / Silverlight technologies. You can visit MixModes at or follow it on Twitter @MixModes

In his free time he is an avid painter, hockey player and enjoys travelling. His blog is at:

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151002.1 | Last Updated 12 Jun 2008
Article Copyright 2008 by Ashish Kaila
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid