I was looking to do binary serialization for a file, and protobuf-net seems like a good alternative. I got a little stuck in the beginning though. Since I want to separate the class definition from the actual serialization, I do not use attributes, but prefer to use .proto files, I have a structure for the object (I think)
message Post {
required uint64 id = 1;
required int32 userid = 2;
required string status= 3;
required datetime created = 4;
optional string source= 5;
}
(is the date-time valid or should I use ticks as int64?)
but I was fixated on how to use protogen, and then serialize IEnumerable of Post into a file and read it. Any help would be appreciated
Another related question: are there any recommendations for detecting corrupt binary files, for example, if the computer is turned off during serialization