CSharp examples for System.IO:FileStream
Write Double value as Big-endian using FileStream
using System.Linq; using System.IO;/* w w w. j a v a2 s. c o m*/ using System.Text; using System.Collections.Generic; using System; public class Main{ /// <summary> /// Write Double value as Big-endian /// </summary> /// <param name="stream"></param> /// <param name="value"></param> public static void WriteDouble(FileStream stream,double value) { var byteArray = BitConverter.GetBytes(value); //Big endian stream.Write((BitConverter.IsLittleEndian) ? byteArray.Reverse().ToArray() : byteArray, 0, byteArray.Length); } }