System.IO.BinaryWriter.Write C# (CSharp) Method

Write() public method

public Write ( float value ) : void
value float
return void
        public unsafe virtual void Write(float value)
        {
            uint TmpValue = *(uint*)&value;
            _buffer[0] = (byte)TmpValue;
            _buffer[1] = (byte)(TmpValue >> 8);
            _buffer[2] = (byte)(TmpValue >> 16);
            _buffer[3] = (byte)(TmpValue >> 24);
            OutStream.Write(_buffer, 0, 4);
        }

Same methods

BinaryWriter::Write ( bool value ) : void
BinaryWriter::Write ( byte value ) : void
BinaryWriter::Write ( byte buffer, int index, int count ) : void
BinaryWriter::Write ( char ch ) : void
BinaryWriter::Write ( char chars, int index, int count ) : void
BinaryWriter::Write ( decimal value ) : void
BinaryWriter::Write ( double value ) : void
BinaryWriter::Write ( int value ) : void
BinaryWriter::Write ( long value ) : void
BinaryWriter::Write ( sbyte value ) : void
BinaryWriter::Write ( short value ) : void
BinaryWriter::Write ( string value ) : void
BinaryWriter::Write ( uint value ) : void
BinaryWriter::Write ( ulong value ) : void
BinaryWriter::Write ( ushort value ) : void

Usage Example

 // DSFチャンクの数字はリトルエンディアンバイトオーダー
 private void BwWriteLE4(BinaryWriter bw, uint v)
 {
     bw.Write((byte)(v & 0xff));
     bw.Write((byte)((v >> 8) & 0xff));
     bw.Write((byte)((v >> 16) & 0xff));
     bw.Write((byte)((v >> 24) & 0xff));
 }
All Usage Examples Of System.IO.BinaryWriter::Write