✅ Binary Formatter
What is better practice to use rather than binary formatter? VS tells me its obsolete
13 Replies
BinaryReader / BinaryWriter
There is no replacement for BinaryFormatter.
There are however libraries that does the job.
Such as MessagePack, and Protobuf
are those in the nuget packages area?
these
Yes.
I recommend MessagePack as that is the fastest
But not the most portable one.
can i work simply with binary reader/writer? this is for school and we are told not to use "pre-written" code
I guess.
But everything is prewritten in the end
Are you not supposed to make your own serializer / deserializer?
haha, i had this debate with my teacher
how to an extent, nothing i write is my own
im simply putting together someone elses work
Do they mean not to use external libraries?
pretty much, i can use anything "made by C#
if that makes sense
default libraries etc System.IO or .net kinda thing is obviosly fine
Then yeah, go with BinaryWriter / BinaryReader
As that is what you should use.
I am using Dapper for my SQL, but think its not too bigger deal
But it still is not the same.
yh ok, nice one
It has methods like ReadInt32, WriteInt32 etc.