ToObservableCollection

/// <summary>
/// To the observable collection.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="value">The value.</param>
/// <returns>ObservableCollection&lt;T&gt;.</returns>
public static ObservableCollection<T> ToObservableCollection<T>(this IList<T> value) where T : class
{
    if (value == null)
    {
        return null;
    }

    var observableCollection = new ObservableCollection<T>(value);
    return observableCollection;
}
Example:
var cityList = new List<string> { "NewYork", "London" };
var cityListObsCollection = cityList.ToObservableCollection();

Description

Return observable collection for IList object.

Details

Double click on the code to select all.

 

;