我正在转换代码以使用新的Microsoft Portable类库。以下代码不满意,我不确定如何修复它。
Dim keySerializer As New Xml.Serialization.XmlSerializer(GetType(TKey))
Dim valSerializer As New Xml.Serialization.XmlSerializer(GetType(T))
Dim key As TKey
Dim val As T
If reader.IsEmptyElement = True Then
Return
End If
reader.Read()
While reader.NodeType <> Xml.XmlNodeType.EndElement
reader.ReadStartElement("item")
reader.ReadStartElement("key")
key = CType(keySerializer.Deserialize(reader), TKey) '<<< Error here
reader.ReadEndElement()
reader.ReadStartElement("value")
val = CType(keySerializer.Deserialize(reader), T) '<<< and here
reader.ReadEndElement()
Add(key, val)
reader.ReadEndElement()
reader.MoveToContent()
End While
reader.ReadEndElement()
请求的操作不可用,因为未定义运行时库函数Microsoft.visubalBasic.CompilerServices.Conversions。
有人解决了这个问题吗?