Click here to Skip to main content
11,928,078 members (51,886 online)
Click here to Skip to main content
Add your own
alternative version


104 bookmarked

List vs ObservableCollection vs INotifyPropertyChanged in Silverlight

, , 21 Sep 2009 CC (ASA 2.5)
Rate this:
Please Sign up or sign in to vote.
This article gives a basic understanding of List, ObservableCollection, and INotifyPropertyChanged.


This article describes the basic understanding between List, ObservableCollection and INotifyPropertyChanged.

Difference between List<T>, ObservableCollection<T> and INotifyPropertyChanged


It represents a strongly typed list of objects that can be accessed by index. It provides methods to search, sort, and manipulate lists. The List<T> class is the generic equivalent of the ArrayList class. It implements the IList<T> generic interface using an array whose size is dynamically increased as required.


In ASP.NET, we simply use DataSource and DataBind() to bind the data, but in Silverlight it is slightly different. Databinding in ASP.NET is done in a stateless way - once that binding operation is completed, it's a done deal and if you want to change anything, you have to manipulate the underlying controls that were created as a result of the data binding, or else change the underlying data objects and call DataBind() again. That’s what we are used to – but it’s not a good practice.


In the sample application, the values in the list are added, removed and changed during runtime in the code behind. The changes in the list will not be updated to the UI (Datagrid).


ObservableCollection is a generic dynamic data collection that provides notifications (using an interface "INotifyCollectionChanged") when items get added, removed, or when the whole collection is refreshed.

Note: WCF service proxy class in Silverlight will use this type of collection by default.



It does not provide any notifications when any property in the collection is changed.


In the sample application, the values in the observable collection are added, removed and changed during runtime in the code behind. The operations (adding and removing an item) in the observable collection will be updated to the UI (Datagrid). But any change in the existing item will not be updated to the UI.


INotifyPropertyChanged is not a collection, it’s an interface used in the data object classes to provide PropertyChanged notification to clients when any property value gets changed. This will allow you to raise PropertyChanged event whenever the state of the object changes (Added, Removed, and Modified) to the point where you want to notify the underlying collection or container that the state has changed.



INotifyPropertyChanged is compatible on all type of collections like List<T>, ObservableCollection<T>, etc. The code snippet which uses INotifyPropertyChanged is shown below:

public class UserNPC:INotifyPropertyChanged
    private string name;
    public string Name { 
        get { return name; } 
        set { name = value; onPropertyChanged(this, "Name"); } 
    public int grade;
    public int Grade { 
        get { return grade; } 
        set { grade = value; onPropertyChanged(this, "Grade"); } 

    // Declare the PropertyChanged event
    public event PropertyChangedEventHandler PropertyChanged;

    // OnPropertyChanged will raise the PropertyChanged event passing the
    // source property that is being updated.
    private void onPropertyChanged(object sender, string propertyName)
        if (this.PropertyChanged != null)
            PropertyChanged(sender, new PropertyChangedEventArgs(propertyName));

In the above code snippet, whenever a value is set to a property, the method “onPropertyChanged” will be called which in turn raises the PropertyChanged event.


  • 22nd September, 2009: Initial post


This article, along with any associated source code and files, is licensed under The Creative Commons Attribution-ShareAlike 2.5 License


About the Authors

BalaG Ganesan
Technical Lead Infosys
India India
Working as a Technology Lead in Infosys at Chennai, India.

Venkatesan Jagadisan
Software Developer iSOFT
India India
Working as a Software Engineer in iSOFT at Chennai, India.

You may also be interested in...

Comments and Discussions

GeneralGreat explanation Pin
Ran nav9-May-15 23:53
memberRan nav9-May-15 23:53 
QuestionGood Article Pin
K K Srinivasan2-Jan-15 2:38
memberK K Srinivasan2-Jan-15 2:38 
QuestionGood to Understand Pin
Member 458721025-Oct-14 3:34
memberMember 458721025-Oct-14 3:34 
GeneralExcellent Pin
Bijay Kant Salotry19-May-14 23:18
memberBijay Kant Salotry19-May-14 23:18 
GeneralMy vote of 4 Pin
csakii1-May-14 9:14
professionalcsakii1-May-14 9:14 
GeneralMy vote of 4 Pin
Rajibdotnet053-Apr-14 8:00
memberRajibdotnet053-Apr-14 8:00 
GeneralMy vote of 5 Pin
URVISH_SUTHAR124-Dec-13 4:05
memberURVISH_SUTHAR124-Dec-13 4:05 
QuestionGreat! Pin
Zia ur Rahman12-Dec-13 5:36
memberZia ur Rahman12-Dec-13 5:36 
GeneralMy vote of 5 Pin
Member 98742804-Sep-13 22:47
memberMember 98742804-Sep-13 22:47 
QuestionSuper Pin
Member 1005388729-May-13 2:05
memberMember 1005388729-May-13 2:05 
QuestionThanks Pin
Member 842326426-May-13 21:50
memberMember 842326426-May-13 21:50 
GeneralMy vote of 5 Pin
Savalia Manoj M17-Apr-13 3:23
memberSavalia Manoj M17-Apr-13 3:23 
QuestionExcellent article, BUT Pin
Aslesh22-Jan-13 11:54
memberAslesh22-Jan-13 11:54 
GeneralMy vote of 5 Pin
handachetan13-Jan-13 16:44
memberhandachetan13-Jan-13 16:44 
GeneralMy vote of 4 Pin
Shah7309-Dec-12 0:34
memberShah7309-Dec-12 0:34 
GeneralMy vote of 5 Pin
Rajesh Varma Buddaraju31-Oct-12 9:09
memberRajesh Varma Buddaraju31-Oct-12 9:09 
GeneralMy vote of 5 Pin
Dellai Houssem23-Oct-12 8:42
memberDellai Houssem23-Oct-12 8:42 
Questionexcellent Pin
bensonissac24-Sep-12 2:04
memberbensonissac24-Sep-12 2:04 
GeneralMy vote of 5 Pin
Farhan Ghumra24-Aug-12 1:53
memberFarhan Ghumra24-Aug-12 1:53 
GeneralGood Article Pin
akhilesh saini19-Jul-12 6:43
memberakhilesh saini19-Jul-12 6:43 
QuestionVote of 4 Pin
sam344016-Jul-12 7:24
membersam344016-Jul-12 7:24 
GeneralMy vote of 4 Pin
govardhanpagidi29-Apr-12 21:26
membergovardhanpagidi29-Apr-12 21:26 
GeneralMy vote of 5 Pin
piapp24-Apr-12 1:14
memberpiapp24-Apr-12 1:14 
GeneralGreat Pin
Member 371070318-Apr-12 2:51
memberMember 371070318-Apr-12 2:51 
QuestionIt's very good article. Pin
AshokReddyProjects19-Jan-12 2:23
memberAshokReddyProjects19-Jan-12 2:23 
GeneralMy vote of 5 Pin
m@dhu27-Dec-11 3:51
memberm@dhu27-Dec-11 3:51 
QuestionExcellent Contrast Pin
Member 15408993-Nov-11 8:00
memberMember 15408993-Nov-11 8:00 
QuestionNice article Pin
Saru.cool5-Sep-11 22:04
memberSaru.cool5-Sep-11 22:04 
GeneralGreat explanation: Vote of 5 Pin
Javed Akhtar Ansari16-Aug-11 21:27
memberJaved Akhtar Ansari16-Aug-11 21:27 
QuestionCorrections... Pin
Member 477740514-Jul-11 0:56
memberMember 477740514-Jul-11 0:56 
Hello Actually Inotify only use to update the UI with changed values it is not use to add/Remove, it you want to use add/remove(for this you need to implement ObservableCollection) and Modify you need to implement INotify with Observable Collecions. Smile | :)
GeneralMy vote of 5 Pin
Azhar Saiyed4-Jul-11 20:04
memberAzhar Saiyed4-Jul-11 20:04 
GeneralMy vote of 4 Pin
rushijoshi25-May-11 1:53
memberrushijoshi25-May-11 1:53 
GeneralMy vote of 2 Pin
Sacha Barber30-Mar-11 1:32
mvpSacha Barber30-Mar-11 1:32 
GeneralMy vote of 5 Pin
Sandeep Mewara21-Dec-10 23:51
mentorSandeep Mewara21-Dec-10 23:51 
GeneralCopy the EventHandler into a local variable before using it Pin
alrabe5-Nov-10 14:09
memberalrabe5-Nov-10 14:09 
GeneralMy vote of 4 Pin
pacreau18-Oct-10 4:51
memberpacreau18-Oct-10 4:51 
GeneralMy vote of 4 Pin
i-jomalo21-Sep-10 4:13
memberi-jomalo21-Sep-10 4:13 
GeneralMy vote of 5 Pin
parthkotak19-Sep-10 23:36
memberparthkotak19-Sep-10 23:36 
GeneralMy vote of 5 Pin
tadanderson13-Sep-10 7:32
membertadanderson13-Sep-10 7:32 
GeneralMy vote of 5 Pin
abhix13-Aug-10 1:30
memberabhix13-Aug-10 1:30 
GeneralThanks Pin
AG_P111-Aug-10 16:26
memberAG_P111-Aug-10 16:26 
GeneralMy vote of 3 Pin
vijayakumar_sht15-Jul-10 2:12
membervijayakumar_sht15-Jul-10 2:12 
GeneralGood Job guys Pin
Supply Chain7-Jun-10 19:58
memberSupply Chain7-Jun-10 19:58 
GeneralGood article Pin
vikas amin12-Feb-10 5:23
membervikas amin12-Feb-10 5:23 
GeneralObservableCollection + INotifyPropertyChanged PinPopular
Alex Mikunov20-Nov-09 21:41
memberAlex Mikunov20-Nov-09 21:41 
GeneralDoes the job Pin
blackjack215022-Sep-09 3:43
memberblackjack215022-Sep-09 3:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151126.1 | Last Updated 22 Sep 2009
Article Copyright 2009 by BalaG Ganesan, Venkatesan Jagadisan
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid