Have such .proto file structure
{
session{
field1 = value;
field2 = value;
...
}
object1{
Object1field1 = value;
Object1field2 = value;
...
}
object1{
Object1field1 = value;
Object1field2 = value;
...
}
object2{
Object2field1 = value;
Object2field2 = value;
...
SubObject1{
SubObject1field1 = value;
SubObject2field2 = value;
...
}
} object2{
Object2field1 = value;
Object2field2 = value;
...
SubObject1{
SubObject1field1 = value;
SubObject2field2 = value;
...
}
}
}
Simply saying have complex hierarchical structure. Object1 or Object2 for example could be repeatable. Is it possible to write universal methods which will return fields values as base objects like int, bool, string, datetime or simply string? I’d like to get following access by string literal:
public object GetFieldValue(int number, string fullPath)
Where fullPath could be specified like this for example:
fullPath = "object1.Object1field1";
number necessary for repeated fields: number could be equal to 0 for first “object1” and 1 for second, for example. Also necessary method to get object1 repeats count by field name:
public int GetFieldCount(string fieldName)
And also need similar way to access SubObjects to any nested level. Is that possible? Is there is an alternative to protocol buffers hardcoded classes?
Hmm… definitely protobuf-csharp-port has everything necessary for this task, example:
As all types derived from IMessage. Will return to it. 😉