ToObservableCollection ToList for IObservable.

This is an easy way to get from point A to Point B.

 

public static class RxForDummysExtentions

 

{

 

// Gof will beat you for using these.

public static ObservableCollection<T> ToObservableCollection<T>(this IObservable<T> input)

{

var output = new ObservableCollection<T>();

input.Do(e => { output.Add(e); });

return output;

}

public static List<T> ToList<T>(this IObservable<T> input)

{

var output = new List<T>();

input.Do(e => { output.Add(e); });

return output;

}

 

}

 

 

 

 

 
}

Share on Facebook

Leave a Reply

Your email address will not be published.