C
C#2y ago
Boggo

✅ Binary Formatter

What is better practice to use rather than binary formatter? VS tells me its obsolete
13 Replies
Buddy
Buddy2y ago
BinaryReader / BinaryWriter There is no replacement for BinaryFormatter. There are however libraries that does the job. Such as MessagePack, and Protobuf
Boggo
BoggoOP2y ago
are those in the nuget packages area? these
Buddy
Buddy2y ago
Yes. I recommend MessagePack as that is the fastest But not the most portable one.
Boggo
BoggoOP2y ago
can i work simply with binary reader/writer? this is for school and we are told not to use "pre-written" code
Buddy
Buddy2y ago
I guess. But everything is prewritten in the end Are you not supposed to make your own serializer / deserializer?
Boggo
BoggoOP2y ago
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
Buddy
Buddy2y ago
Do they mean not to use external libraries?
Boggo
BoggoOP2y ago
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
Buddy
Buddy2y ago
Then yeah, go with BinaryWriter / BinaryReader As that is what you should use.
Boggo
BoggoOP2y ago
I am using Dapper for my SQL, but think its not too bigger deal
Buddy
Buddy2y ago
But it still is not the same.
Boggo
BoggoOP2y ago
yh ok, nice one
Buddy
Buddy2y ago
It has methods like ReadInt32, WriteInt32 etc.
Want results from more Discord servers?
Add your server