我有以下模型,我将其加载到 IList 集合中并针对其运行 Linq 查询。我遇到的问题是 Linq 查询将 OPCServer 成员作为 IEnumerable(of Char) 返回。这是否有理由不返回基础字符串?
如果我用 a 迭代集合,For Each
那么它会按预期返回字符串。
我是否必须手动将其转换回工作代码部分中的显示?
模型
Friend Class OpcDataTags
Public Property Host As String
Public Property HostLive As Boolean
Public Property OpcServer As String
Public Property OpcChannel As String
Public Property PlcDns As String
Public Property PlcIP As String
Public Property Zone As String
Public Property DataBlock As String
Public Property StartByte As Int16
Public Property ByteSize As Int16
Public Property DataType As String
Public Property Subscribed As Boolean
Public Property Description As String
Public Property ArraySize As Nullable(Of Int32)
Public Property Abbreviation As String
Public Property PlcID As Int32
End Class
收藏
Friend Property OpcTags As IList(Of OpcDataTags)
查询
Dim server = From o In OpcTags.First.OpcServer
工作代码
Dim result = From o In OpcTags.First.OpcServer
Dim server As String = New String(result.ToArray)