Esempio n. 1
0
        public MemoryStreamWrapper GetStreamWrapper()
        {
            NoClosingMemoryStream returnStream;

            if (!_streams.TryDequeue(out returnStream))
            {
                returnStream = new NoClosingMemoryStream();
            }
            return(new MemoryStreamWrapper(
                       returnStream,
                       _streams
                       ));
        }
Esempio n. 2
0
 public MemoryStreamWrapper(
     NoClosingMemoryStream ms,
     ConcurrentQueue <NoClosingMemoryStream> addOnExit
     )
 {
     if (ms == null)
     {
         throw new ArgumentNullException(
                   MyNameof.GetLocalVarName(() => ms));
     }
     if (addOnExit == null)
     {
         throw new ArgumentNullException(
                   MyNameof.GetLocalVarName(() => addOnExit));
     }
     _addOnExit = addOnExit;
     _ms        = ms;
 }