Why does SerializationInfo not have TryGetValue methods?

前端 未结 3 1703
暗喜
暗喜 2021-02-12 16:49

When implementing the ISerializable interface in C#, we provide a constructor which takes a SerializationInfo object, and then queries it with various

3条回答
  •  再見小時候
    2021-02-12 17:12

    You can iterate over the available fields and use switch, though...

    foreach(SerializationEntry entry in info) {
        switch(entry.Name) {
            ...
        }
    }
    

    Or you could use protobuf-net ;-p

提交回复
热议问题