Skip to content

Instantly share code, notes, and snippets.

View MarcelMalik's full-sized avatar

Marcel MarcelMalik

View GitHub Profile
public static class HttpClientRxMixins
{
public static IObservable<T> RequestAsync<T>(this HttpClient This, string requestUri)
{
return This.GetAsync(requestUri).ToObservable()
.ThrowOnRestResponseFailure()
.SelectMany(x => x.Content.ReadAsStringAsync().ToObservable())
.SelectMany(x => JsonConvert.DeserializeObjectAsync<T>(x).ToObservable());
}
@robfe
robfe / Extensions.cs
Created October 11, 2010 08:45
ObservePropertyChanged extension method (INotifyPropertyChanged.Property => IObservable)
public static class Extensions
{
public static IObservable<TProperty> ObservePropertyChanged<TNotifier, TProperty>(
this TNotifier notifier,
Expression<Func<TNotifier, TProperty>> propertyAccessor,
bool startWithCurrent = false)
where TNotifier : INotifyPropertyChanged
{
// Parse the expression to find the correct property name.