public Stream GetStreamFromInt(int bytesToStream) { var stream = new VerifiableStream(bytesToStream); OperationContext clientContext = OperationContext.Current; clientContext.OperationCompleted += new EventHandler(delegate (object sender, EventArgs args) { stream.Dispose(); }); return stream; }
public Stream GetStreamFromInt(int bytesToStream) { var stream = new VerifiableStream(bytesToStream); OperationContext clientContext = OperationContext.Current; clientContext.OperationCompleted += new EventHandler(delegate(object sender, EventArgs args) { stream.Dispose(); }); return(stream); }
public int GetIntFromStream(Stream stream) { // a negative expectedStreamSize means we don't know the expected size // and the bufSize is an arbitrary large enough size return(VerifiableStream.VerifyStream(stream, expectedStreamSize: -1, bufSize: 4096)); }