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;

}

 

}

 

 

 

 

 
}

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: