I have to read a binary file data into a C# winform application.
The binary reading is frequent, i.e. many form reads different section of data.
I can create a C++ dll to read the binary file and use it in C# application.
or
I can have the reading logic in C#.
The main issue if performance.
If I write it into C# will it give me the lighting speed as of C++.
If I use C++ and every time C# application call it through interfaces will the overall speed will be the same.
Reading from disk is mostly an I/O bound operation so it will make little difference if you write it in C# or C++.
To maximize performance I would suggest reading the entire file into memory in one go (assuming the file is not too large) rather than seeking backwards and forwards in the file to read different sections.