|
Yes. The ReadStruct<t> function may help me for some situation. Anyway, thanks for sharing.
|
|
|
|
|
Hi Olivier,
I don't think your class is faster. For FileStream, we can define the buffer size by use other constructor. For example:
public FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize);
|
|
|
|
|
All right, so just forget about my buffered classes You can still use the other classes (BinaryReaderEx and BinaryWriterEx ) if you find them useful.
|
|
|
|
|
You are not wrong, FileStream is buffered. The reason why I didn't mention it is just because I didn't know it!! I searched MSDN for handling files and streams, found the examples using StreamReader, BinaryReader, TextWriter, and so on but I hadn't found that one... Anyway, I did (quickly) a few tests to compare FileStream.Write and my BufferedFileWriter.Write function (I wrote the exact same data several times and in different orders) and it appears that my class is about 10% faster. Not much. Probably because the size of the internal buffer is different. Thank you for your comment. Even though they are a little bit faster, I think the use of BufferedFileWriter and BufferedFileReader classes makes less sense now!
|
|
|
|