System.IO.BinaryWriter.Write C# (CSharp) Метод

Write() публичный Метод

public Write ( decimal value ) : void
value decimal
Результат void
        public virtual void Write(decimal value)
        {
            int[] bits = decimal.GetBits(value);
            Debug.Assert(bits.Length == 4);

            int lo = bits[0];
            _buffer[0] = (byte)lo;
            _buffer[1] = (byte)(lo >> 8);
            _buffer[2] = (byte)(lo >> 16);
            _buffer[3] = (byte)(lo >> 24);

            int mid = bits[1];
            _buffer[4] = (byte)mid;
            _buffer[5] = (byte)(mid >> 8);
            _buffer[6] = (byte)(mid >> 16);
            _buffer[7] = (byte)(mid >> 24);

            int hi = bits[2];
            _buffer[8] = (byte)hi;
            _buffer[9] = (byte)(hi >> 8);
            _buffer[10] = (byte)(hi >> 16);
            _buffer[11] = (byte)(hi >> 24);

            int flags = bits[3];
            _buffer[12] = (byte)flags;
            _buffer[13] = (byte)(flags >> 8);
            _buffer[14] = (byte)(flags >> 16);
            _buffer[15] = (byte)(flags >> 24);

            OutStream.Write(_buffer, 0, 16);
        }

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 ( double value ) : void
BinaryWriter::Write ( float 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