The reason is that in the Function
public function GetTags(ByVal fn as String) as Tags()
aryOfTags = New Tags() {New Tags(tagName, tagValue)
aryOfTags = New Tags() {New Tags(tagName, tagValue)
Return aryOfTags
End Function
Under
Look for more tags, An new array of tags is assigned to aryOfTags, which replaces the array of tags already assigned under the first step. So, only aryOfTags contains only one element assigned in the second step.
Two return two tags, the following modification can be done.
Public Class WMAID3Tag.vb
dim aryOfTags(1) as Tags
public function GetTags(ByVal fn as String) as Tags()
aryOfTags(0) = New Tags(tagName, tagValue)
aryOfTags(1) = New Tags(tagName, tagValue)
Return aryOfTags
End Function
End Class
However, it is preferable to use List to dynamically assign number of elements without first defining the size. In the above function the size of array is declared as 2 Nos. If more are expected, then size shall be fixed accordingly.
The function using List is as follows
public function GetTagsList(ByVal fn as String) as List(Of Tags)
dim listOfTags as new List(Of Tags)
listOfTags.Add(New Tags("tag1", "value1"))
listOfTags.Add(New Tags("tag2", "value2"))
listOfTags.Add(New Tags("tag3", "value3"))
Return listOfTags
End Function