У меня есть данные в формате Protocol Buffers, которые можно описать следующим образом
message Sections {
repeated Section sections = 1;
}
message Section {
required uint32 type = 1;
required bytes payload = 2;
}
message SectionType1 {
required int32 fieldType1 = 1;
// ...
}
message SectionType2 {
required int32 fieldType2 = 1;
// ...
}
message SectionType3 {
required int32 fieldType3 = 1;
// ...
}
Я использую библиотеку protobuf-net (+ protogen + precompile). Как мне десериализовать такие данные в DTO, подобные
public class Sections
{
public List<Section> Sections { get; }
}
public abstract class Section
{
}
public class SectionType1 : Section
{
public int FieldType1 { get; }
}
public class SectionType2 : Section
{
public int FieldType2 { get; }
}
public class SectionType3 : Section
{
public int FieldType3 { get; }
}
Можно ли работать с такими данными из .NET (используя прекомпиляцию, т.к. я на лайт фреймворке)?