0

我正在尝试使用 XmlReader 读取 xml,但我收到了一个我没想到的异常。

ArgumentException: Specified type 'System.Guid' is not supported.
System.Xml.XmlReader.ValueAs (System.String text, System.Type type, IXmlNamespaceResolver resolver)
System.Xml.XmlReader.ReadElementContentAs (System.Type type, IXmlNamespaceResolver resolver)

在以下代码行中引发了异常:

propInfo.Value = _cReader.ReadElementContentAs(propInfo.PropertyType, null);

propInfo必须序列化的公共属性(getter-setter)的包装器在哪里。在这行代码中,我尝试从 xml 读取值并将其设置在包装器中。我以为 aSystem.Guid会被支持,因为还有一个XmlConvert.ToGuid()方法。

通过这种方式序列化单一类型的 xmlelement 的好方法是什么?XmlSerializer由于复杂的原因,我不能使用Mono。

4

0 回答 0