Hello. So I wrote data to the file using the BinaryWriter
class, everything goes according to the objects. So, how to calculate how many objects are there?
- oneWhat, where, as recorded? Code where? Session telepathy chtoli? Do you want to count the number of bytes in a filestream? For this you can use the FileStream.Seek () & FileStream.ReadByte () methods. - Olter
|
2 answers
Instead of direct writing to the file through the stream, use serialization, namely, serialize the list with objects and, if necessary, de-serialize it back. After that, the list can simply take Count and understand the number of objects.
|
No This can be done by the program that creates the file, and then in some form output the "map" of the file created by it.
Read carefully the description of the methods of the BinaryWriter
and the questions will disappear.
|