Click or drag to resize
BinaryWriter Class
Writes primitive types in binary to a stream and supports writing strings in a specific encoding.
Inheritance Hierarchy
SystemObject
  System.IOBinaryWriter

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
[SerializableAttribute]
public class BinaryWriter : IDisposable

The BinaryWriter type exposes the following members.

Methods
  NameDescription
Public methodDispose
Releases all resources used by the current instance of the BinaryWriter class.
Protected methodDispose(Boolean)
Releases the unmanaged resources used by the BinaryWriter and optionally releases the managed resources.
Public methodEquals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFlush
Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSeek
Sets the position within the current stream.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWrite(Boolean)
Writes a one-byte Boolean value to the current stream, with 0 representing false and 1 representing true.
Public methodWrite(Byte)
Writes an unsigned byte to the current stream and advances the stream position by one byte.
Public methodWrite(Byte)
Writes a byte array to the underlying stream.
Public methodWrite(Char)
Writes a Unicode character to the current stream and advances the current position of the stream in accordance with the Encoding used and the specific characters being written to the stream.
Public methodWrite(Char)
Writes a character array to the current stream and advances the current position of the stream in accordance with the Encoding used and the specific characters being written to the stream.
Public methodWrite(Decimal)
Writes a decimal value to the current stream and advances the stream position by sixteen bytes.
Public methodWrite(Double)
Writes an eight-byte floating-point value to the current stream and advances the stream position by eight bytes.
Public methodWrite(Int16)
Writes a two-byte signed integer to the current stream and advances the stream position by two bytes.
Public methodWrite(Int32)
Writes a four-byte signed integer to the current stream and advances the stream position by four bytes.
Public methodWrite(Int64)
Writes an eight-byte signed integer to the current stream and advances the stream position by eight bytes.
Public methodWrite(SByte)
Writes a signed byte to the current stream and advances the stream position by one byte.
Public methodWrite(Single)
Writes a four-byte floating-point value to the current stream and advances the stream position by four bytes.
Public methodWrite(String)
Writes a length-prefixed string to this stream in the current encoding of the BinaryWriter, and advances the current position of the stream in accordance with the encoding used and the specific characters being written to the stream.
Public methodWrite(UInt16)
Writes a two-byte unsigned integer to the current stream and advances the stream position by two bytes.
Public methodWrite(UInt32)
Writes a four-byte unsigned integer to the current stream and advances the stream position by four bytes.
Public methodWrite(UInt64)
Writes an eight-byte unsigned integer to the current stream and advances the stream position by eight bytes.
Public methodWrite(Byte, Int32, Int32)
Writes a region of a byte array to the current stream.
Public methodWrite(Char, Int32, Int32)
Writes a section of a character array to the current stream, and advances the current position of the stream in accordance with the Encoding used and perhaps the specific characters being written to the stream.
Protected methodWrite7BitEncodedInt
Writes a 32-bit integer in a compressed format.
Top
Fields
  NameDescription
Public fieldStatic memberNull
Specifies a BinaryWriter with no backing store.
Protected fieldOutStream
Holds the underlying stream.
Top
Properties
  NameDescription
Public propertyBaseStream
Gets the underlying stream of the BinaryWriter.
Top
See Also