更新时间:2023-11-29 19:47:28
这是 [国旗]
枚举,它并没有真正在protobuf的直接映射(由谷歌定义)。我只想重新公开为 INT
:
That is a [Flags]
enum, which doesn't really have a direct map in protobuf (as defined by google). I would simply re-expose as int
:
public FileAttributes Attributes {get;set;}
[ProtoMember(12)] // whavever
private int AttributesSerialized {
get { return (int)Attributes; }
set { Attributes = (FileAttributes)value; }
}
此外,IIRC,我已经codeD V2以这种方式操作的 [国旗]
自动,并有选择地允许直通枚举(治疗作为基础值自动)。
Additionally, IIRC, I have already coded v2 to operate this way on [Flags]
automatically, and to optionally allow pass-thru of enums (to treat as the underlying value automatically).