.Net StreamWriter.BaseStream, what does this definition mean? "Gets the underlying stream that interacts with the backup storage."

Today I read on StreamWriterand came across this property BaseStream.

I searched for a definition and found this

"Gets the underlying stream that interacts with the backup storage."

from here MSDN - StreamWriter.BaseStream

I understand what BaseStream is for StreamReader, because this definition is very simple:

Returns the base stream.

But what does the definition of StreamWriter.BaseStream mean? Or more clearly, what does this part of the definition of “backup interfaces” mean? It sounds like gibberish.

+3
source share
3 answers

; , StreamReader.BaseStream. , , , StreamReader.

, , - , . , ( ).

, , CanWrite - true ( , , StreamWriter).


, , Reflector:

public virtual Stream BaseStream
{
    [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
    get
    {
        return this.stream;
    }
}

stream Init:

private void Init(Stream stream, Encoding encoding, int bufferSize)
{
    this.stream = stream;
   ...

, , , :

[SecuritySafeCritical]
public StreamWriter(Stream stream, Encoding encoding, int bufferSize) 
  : base(null)
{
    ...
    this.Init(stream, encoding, bufferSize);
}

+2

, Stream :

.

StreamWriter:

TextWriter .

, BaseStream - , . FileStream MemoryStream - , Stream. , :

.

+2

, , "daisychain".

, A, B, C, .

- B .

0
source

Source: https://habr.com/ru/post/1784645/


All Articles