Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (34 sloc) 0.92 kb
using System.IO;
using System.Reactive;
using System.Reactive.Subjects;
namespace System
{
public static class StreamMixins
{
public static IObservable<Unit> WriteAsync(this Stream This, byte[] data, int start, int length)
{
var ret = new AsyncSubject<Unit>();
try
{
This.BeginWrite(data, start, length, result =>
{
try
{
This.EndWrite(result);
ret.OnNext(Unit.Default);
ret.OnCompleted();
}
catch (Exception ex)
{
ret.OnError(ex);
}
}, null);
}
catch (Exception ex)
{
ret.OnError(ex);
}
return ret;
}
}
}
Jump to Line
Something went wrong with that request. Please try again.