Solved

INotifyPropertyChanged :Console program

Posted on 2010-09-24
4
353 Views
Last Modified: 2013-12-16
Hi Friends,

Can you please give me  a sample program for INotifyPropertyChanged ( with console project)

Thanks
0
Comment
Question by:N_Sri
  • 2
4 Comments
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 33751912

class Program

    {

        static void Main(string[] args)

        {

            Person p = new Person();

            p.PropertyChanged += new PropertyChangedEventHandler(p_PropertyChanged);

            p.name = "Gautham";

            Console.Read();

        }



        static void p_PropertyChanged(object sender, PropertyChangedEventArgs e)

        {

            Console.WriteLine("Property changed :" + e.PropertyName);

        }

    }



    public class Person : INotifyPropertyChanged

    {



        #region INotifyPropertyChanged Members



        public event PropertyChangedEventHandler PropertyChanged;

        protected void NotifyPropertyChanged(string propertyName)

        {

            if (PropertyChanged != null)

            {

                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));

            }

        }

        #endregion





        private string _name;

        public string name

        {

            get

            {

                return _name;

            }

            set

            {

                _name = value;

                NotifyPropertyChanged("name");

            }

        }

    }

Open in new window

0
 

Author Closing Comment

by:N_Sri
ID: 33756416
thankyou
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 33756643
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 33756648
The above link also might help
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now