Click here to Skip to main content
15,883,843 members
Articles / Programming Languages / C#

SmartLists - Extended Lists with Events

Rate me:
Please Sign up or sign in to vote.
4.00/5 (2 votes)
29 Sep 2010BSD2 min read 17.8K   122   10  
SmartLists library is a collection of classes that extends the standard C# List object
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace SmartListsTest
{
    class Book : INotifyPropertyChanged
    {
        private string _author = String.Empty;
        private string _title = String.Empty;

        public Book()
        {
        }

        public Book(string author, string title)
        {
            this.Author = author;
            this.Title = title;
        }

        public string Author
        {
            get { return _author; }
            set
            {
                _author = value;
                this.OnPropertyChanged("Author");
            }
        }

        public string Title
        {
            get { return _title; }
            set
            {
                _title = value;
                this.OnPropertyChanged("Title");
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            if(this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        #endregion
    }
}

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 BSD License


Written By
Software Developer (Senior)
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions