Ausländer
Ausländer

Reputation: 499

.Net dictionary type in protobuff

Can you help me identify this type in protobuff. Error is missing ">"

class SomeRequest
{
   Dictionary<long,List<string>> values;
}   
message SomeRequest
{
   map<int64,repeated string> values = 1;
}

Upvotes: 2

Views: 103

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1062975

Basically, you can't do that. The closest you can get is a map to something that has a repeated element, so:

message SomeRequest
{
   map<int64,Thing> values = 1;
}
message Thing {
  repeated string items = 1;
}

Or in c# terms:

class SomeRequest
{
   Dictionary<long,Thing> values;
}
class Thing
{
    List<string> items;
}

Upvotes: 1

Related Questions