Click here to Skip to main content
15,881,715 members
Articles / Web Development / ASP.NET

Observer Pattern in .NET

Rate me:
Please Sign up or sign in to vote.
4.39/5 (25 votes)
9 Mar 2004CPOL4 min read 139.2K   1.6K   65  
A mechanism for drastically reducing coupling between interacting classes
using System;

namespace ObserverPatternClassic
{
	/// <summary>
	/// Summary description for SouthernTravels.
	/// </summary>
	public class SouthernTravels : Observer
	{
		public void UpdateBangaloreAirlinesRout(object Traveller)
		{
			if( Traveller is BangaloreAirlines)
			{

				AddRoutforBangaloreAirlines((BangaloreAirlines)Traveller);

			}

		}

		private void AddRoutforBangaloreAirlines(BangaloreAirlines traveller)
		{
			//Code for adding the new rout to Southern Travel's Travel database.
			Console.WriteLine("new rout No. " +  traveller.TravelRout  + " Added Sucessfully to SothernTravel's Database");
		}

		
	}
		
	}

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.

License

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


Written By
Web Developer
United States United States
Sunil Kumar Works for Wipro Technologies, one of the leading software services company in the world. He is a Microsoft Certified Solution Developer(MCSD) in .NET

Comments and Discussions