I am working on my own remote desktop C# program. I wondered if I could Serialize using BinaryFormatter an object of my own for example \"Packet\" that contains properties of B
This is possible, but I discourage it. The BinaryFormatter
algorithm is proprietary, so it will be very difficult to write non-.NET applications using such data. The format has changed in the past, and may change in the future, so it is unsafe to use it for persistent data you expect to open again in the future with a new .NET version. I think BinaryFormatter
was originally designed for passing data between processes on one machine, not for persisting data.
BinaryFormatter
is inefficient for data that contains multiple properties because it requires deserializing the entire object to access any field. This is especially problematic if the data contains large data like images.
If your data does not require random access, I suggest serializing it to a text format like JSON or XML. If the data is large, you should consider compressing the text-encoded data.
If you require random-access to data you should investigate data stores like MySQL or SQLite.