经过一些搜索,似乎:
repeated type thislist = 1;
我应该制作一个列表,但是出现了以下错误:
无法将“Google.Protobuf.Collections.RepeatedField”转换为“System.Collections.Generic.List”
我做错了什么吗?
经过一些搜索,似乎:
repeated type thislist = 1;
我应该制作一个列表,但是出现了以下错误:
无法将“Google.Protobuf.Collections.RepeatedField”转换为“System.Collections.Generic.List”
我做错了什么吗?
IList<T>
), 而不是List<T>
。(protogen) C#
和(protoc) C#
之间更改工具 - protogen (protobuf-net) 给出:[global::ProtoBuf.ProtoMember(1)]
public global::System.Collections.Generic.List<type> thislist { get; }
= new global::System.Collections.Generic.List<type>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<global::type> Thislist {
get { return thislist_; }
IList
和IList<T>
,而不是从具体类List
派生而来。(请参阅 https://developers.google.com/protocol-buffers/docs/reference/csharp/class/google/protobuf/collections/repeated-field-t-) - orhtej2