First you need to know the following to answer your question:
- If you have already done the XML file interpreter, and
- How are you dealing with each element.
Assuming you are using a dynamic class, which has the properties
Nome
and
Path
, enumerate the XML elements with a phantom list by adding each name in the list.
Below is a pseudo-code, which made you understand the algorithm.
Variável ListaFantasma é uma nova Lista (de string)
Sendo XmlElement cada elemento XML no arquivo, faça:
Se ListaFantasma contém XmlElement -> Nome:
// Contém o nome, o que fazer agora?
Caso contrário:
// Não contém o nome
Fim do Se
Fim do Sendo
The above pseudo-code in Visual Basic .NET would look something like this:
Public Class MusicaItem
Public Property Nome As String
Public Property Path As String
End Class
...
Dim Musicas As New List(Of MusicaItem)
Dim ListaFantasma As New List(Of String)
For Each Musica As MusicaItem In Musicas
If ListaFantasma.Contains(Musica.Nome) Then
' Contém o nome
Else
' Não contém o nome
...
' Sempre adicione o nome para saber que ele já passou por aqui
ListaFantasma.Add(Musica.Nome)
End If
Next
In the code above, I've already created the dynamic class for each element in its XML. The Musica.Nome
item is added to the ghost list, so it is always checked if the item already exists in the list.
If you have not developed a code to interpret XML, consider opening a new question, or learn read XML files with Visual Basic .