I fix it by using my own class type, I mean by replacing the System.Drawing.Rectangle to my own class than contains the same properties.
I mean if you want to serialize and deserialize you have to use common types.
Pergunta
If I Serialize (using protobuf) a rectangle (System.Drawing.Rectangle) in c#, is that possible to Deserialize it in Objective-C or C++, because System.Drawing.Rectangle is not common type like int.
If possible, what is the best way to get this rectangle in c++ or Objective-c?
Solução
I fix it by using my own class type, I mean by replacing the System.Drawing.Rectangle to my own class than contains the same properties.
I mean if you want to serialize and deserialize you have to use common types.
Outras dicas
The System.Drawing.Rectangle
type is not supported directly in protobuf-net (the auto-tuple code doesn't trigger because of a few extra properties), so I'm assuming that you either have a surrogate in place, or you are configuring the model manually - for example:
RuntimeTypeModel.Default.Add(typeof(Rectangle),false)
.Add("X","Y","Width","Height");
In which case, what you need to do is to create a .proto schema that matches that. protobuf-net will actually help you here:
var proto = RuntimeTypeModel.Default.GetSchema(typeof(Rectangle));
which for me (i.e. for the configuration I used) generates:
message Rectangle {
optional int32 X = 1;
optional int32 Y = 2;
optional int32 Width = 3;
optional int32 Height = 4;
}
This should be usable from any protobuf implementation.