C# BinaryReader ReadDouble
Description
BinaryReader ReadDouble
Reads an 8-byte floating point
value from the current stream and advances the current position of the stream
by eight bytes.
Syntax
BinaryReader.ReadDouble
has the following syntax.
public virtual double ReadDouble()
Returns
BinaryReader.ReadDouble
method returns An 8-byte floating point value read from the current stream.
Example
using System;//from w w w . j a v a 2 s. c o m
using System.IO;
class ConsoleApplication
{
const string fileName = "data.dat";
static void Main()
{
using (BinaryWriter writer = new BinaryWriter(File.Open(fileName, FileMode.Create)))
{
writer.Write(1.2D);
}
using (BinaryReader reader = new BinaryReader(File.Open(fileName, FileMode.Open)))
{
Console.WriteLine(reader.ReadDouble());
}
}
}
The code above generates the following result.