protobuf 中的 .Net 字典类型
.Net dictionary type in protobuff
你能帮我在protobuf中识别这个类型吗?错误缺少“>”
class SomeRequest
{
Dictionary<long,List<string>> values;
}
message SomeRequest
{
map<int64,repeated string> values = 1;
}
基本上,你不能那样做。您可以获得的最接近的是 具有 重复元素的地图,因此:
message SomeRequest
{
map<int64,Thing> values = 1;
}
message Thing {
repeated string items = 1;
}
或者用 c# 术语来说:
class SomeRequest
{
Dictionary<long,Thing> values;
}
class Thing
{
List<string> items;
}
你能帮我在protobuf中识别这个类型吗?错误缺少“>”
class SomeRequest
{
Dictionary<long,List<string>> values;
}
message SomeRequest
{
map<int64,repeated string> values = 1;
}
基本上,你不能那样做。您可以获得的最接近的是 具有 重复元素的地图,因此:
message SomeRequest
{
map<int64,Thing> values = 1;
}
message Thing {
repeated string items = 1;
}
或者用 c# 术语来说:
class SomeRequest
{
Dictionary<long,Thing> values;
}
class Thing
{
List<string> items;
}