Ich habe Quelle unter:Woher weiß ich den aktuellen Offset von BinaryReader in C#?
public static void DisplayValues()
{
float aspectRatio;
string tempDirectory;
int autoSaveTime;
bool showStatusBar;
if (File.Exists(fileName))
{
using (BinaryReader reader = new BinaryReader(File.Open(fileName, FileMode.Open)))
{
aspectRatio = reader.ReadSingle();
tempDirectory = reader.ReadString();
------------------------------------------------> I want to know current offset.
autoSaveTime = reader.ReadInt32();
showStatusBar = reader.ReadBoolean();
}
Console.WriteLine("Aspect ratio set to: " + aspectRatio);
Console.WriteLine("Temp directory is: " + tempDirectory);
Console.WriteLine("Auto save time set to: " + autoSaveTime);
Console.WriteLine("Show status bar: " + showStatusBar);
}
}
Ich habe Strom von Binary versetzt, um herauszufinden.
Sie beachten, dass Sie die starke Annahme, dass Binary puffert keine Bytes von der Basis Strom. Es puffert Bytes. Aber nicht in einer Weise, die dich durchbohren wird. –