Skip to content

Commit 6227f7d

Browse files
committed
fix of the data model of the xrefs collection read from the sbml file
1 parent 9e3420a commit 6227f7d

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

  • Microsoft.VisualBasic.Core/src/Text/Xml/Models/ValueTuples

Microsoft.VisualBasic.Core/src/Text/Xml/Models/ValueTuples/NamedValues.vb

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Imports Microsoft.VisualBasic.ComponentModel.Collection.Generic
7676
Imports Microsoft.VisualBasic.ComponentModel.DataSourceModel
7777
Imports Microsoft.VisualBasic.ComponentModel.DataSourceModel.Repository
7878
Imports Microsoft.VisualBasic.Language
79+
Imports Microsoft.VisualBasic.Linq
7980

8081
Namespace Text.Xml.Models
8182

@@ -184,8 +185,7 @@ Namespace Text.Xml.Models
184185
''' 在这里不实现<see cref="IEnumerable(Of T)"/>是为了方便的实现XML序列化操作
185186
''' </summary>
186187
''' <typeparam name="T"></typeparam>
187-
Public Structure NamedVector(Of T)
188-
Implements INamedValue
188+
Public Class NamedVector(Of T) : Implements INamedValue, Enumeration(Of T)
189189

190190
<XmlAttribute>
191191
Public Property name As String Implements IKeyedEntity(Of String).Key
@@ -198,8 +198,8 @@ Namespace Text.Xml.Models
198198

199199
Sub New(namedCollection As NamedCollection(Of T))
200200
With namedCollection
201-
name = .Name
202-
vector = .Value
201+
name = .name
202+
vector = .value
203203
End With
204204
End Sub
205205

@@ -208,8 +208,21 @@ Namespace Text.Xml.Models
208208
Me.vector = vector
209209
End Sub
210210

211+
Sub New()
212+
End Sub
213+
211214
Public Overrides Function ToString() As String
212215
Return name
213216
End Function
214-
End Structure
217+
218+
Public Iterator Function GenericEnumerator() As IEnumerator(Of T) Implements Enumeration(Of T).GenericEnumerator
219+
If vector Is Nothing Then
220+
Return
221+
End If
222+
223+
For Each item As T In vector
224+
Yield item
225+
Next
226+
End Function
227+
End Class
215228
End Namespace

0 commit comments

Comments
 (0)