示例#1
0
        public static BufferTextWriter Get(IBufferWriter <byte> bufferWriter)
        {
            var writer = Instance ?? new BufferTextWriter(null); //Special initialization to track prior use.

            Instance = null;                                     // Taken off the thread static
#if DEBUG
            if (writer.InUse)
            {
                throw new InvalidOperationException($"The {nameof(BufferTextWriter)} wasn't returned!");
            }
#endif
            writer.BufferWriter.Reset(bufferWriter);
            return(writer);
        }
示例#2
0
 public static void Return(BufferTextWriter writer)
 {
     writer.BufferWriter.Reset();
     Instance = writer;
 }