Protocol Buffers In C#: How Are Boxed Value Types Handled
- by Greg Dean
In the following examples:
public class RowData
{
public object[] Values;
}
public class FieldData
{
public object Value;
}
I am curious as how either protobuf-net or dotnet-protobufs would handle such classes. I am more familiar with protobuf-net, so what I actually have is:
[ProtoContract]
public class RowData
{
[ProtoMember(1)]
public object[] Values;
}
[ProtoContract]
public class FieldData
{
[ProtoMember(1)]
public object Value;
}
However I get an error saying "No suitable Default Object encoding found". Is there an easy way to treat these classes, that I am just not aware of?
To elaborate more on the use case:
This is a scaled down version of a data class used in remoting. So essentially it looks like this:
FieldData data = new FieldData();
data.Value = 8;
remoteObject.DoSomething(data);
Note: I've omitted the ISerializable implementation for simplicity, but it is as you'd expect.