How to Convert a List to ObservableCollection in C#?

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);