C# BinaryWriter Write(UInt64)
Description
BinaryWriter Write(UInt64)
Writes an eight-byte unsigned
integer to the current stream and advances the stream position by eight bytes.
Syntax
BinaryWriter.Write(UInt64)
has the following syntax.
[CLSCompliantAttribute(false)]
public virtual void Write(
ulong value
)
Parameters
BinaryWriter.Write(UInt64)
has the following parameters.
value
- The eight-byte unsigned integer to write.
Returns
BinaryWriter.Write(UInt64)
method returns
Example
using System;//www .j a va 2 s . c om
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((UInt64)123);
}
using (BinaryReader reader = new BinaryReader(File.Open(fileName, FileMode.Open)))
{
Console.WriteLine(reader.ReadUInt64());
}
}
}
The code above generates the following result.