Click here to Skip to main content
15,896,492 members
Articles / Programming Languages / C#

Implementing Observer pattern in .NET

Rate me:
Please Sign up or sign in to vote.
2.74/5 (21 votes)
28 Apr 2007CPOL5 min read 46K   72   35  
The observer pattern should be used whenever one or more objects (observers) are interested to know the states of subject
using System;
using System.Collections.Generic;
using System.Text;

namespace ObserverPattern
{
    class CurrencyRateChangeInfo
    {
        public string sCurrencyName;  // name of the currency
        public double dNewRate;  // new rate value
        public DateTime tChangeTime;

        public CurrencyRateChangeInfo(string name, double rate, DateTime time)
        {
            sCurrencyName = name;
            dNewRate = rate;
            tChangeTime = time;
        }

    }
}

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
Bangladesh Bangladesh
This is S.M. Rabiul Islam from Bangladesh, I have been working as a software engineer here in Bangladesh at offshore software development house

Comments and Discussions