Verily, I do not know this. However, you can use something like Stack and just Push () and Pop () from this to go up and down your markers in order:
FileStream file = new FileStream(...);
try {
Stack<long> markers = new Stack<long>();
markers.Push(file.Position);
file.Read(....);
file.Seek(markers.Pop(),SeekOrigin.Begin);
} finally {
file.Close();
}
Another dictionary based idea:
FileStream file = new FileStream(...);
try {
Dictionary<string,long> markers = new Dictionary<string,long>();
markers.Add("thebeginning",file.Position);
file.Read(....);
file.Seek(markers["thebeginning"],SeekOrigin.Begin);
} finally {
file.Close();
}
Lloyd source
share