How to Convert a List to ObservableCollection in C#?


This content was proof-read by Grammarly. You can Try Grammary for FREE

This simple blog post will explain how to convert a List of Object to ObservableCollection of Object in C# and Windows Phone 8.

There are times when you want to convert a List of Object to ObservableCollection specially when binding an ObservableCollection to the LongListSelector etc. The reasons for this can be several.

How to Convert a List to ObservableCollection in C#?

To Convert a List to ObservableCollection in C#, Follow the below steps

Assume that you have List<Employee> which needs to be converted to ObservableCollection<Employee>. Below is a sample code snippet that does this.

List<Employee> employees = new List<Employee>();

ObservableCollection<Employee> sessions = new ObservableCollection<Employee>(employees);
Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

%d bloggers like this: