16,721
社区成员




Sub test()
Dim dic As New Dictionary(Of String, String)
Dim arr() As String = {"a,23sd44", "a,23s5sf4", "bb,sd2364", "a,2f534", "bb,2sfds434"}
For i As Integer = 0 To UBound(arr)
dic(Split(arr(i), ",")(0)) = arr(i)
Next
Dim brr() As String = dic.Values.ToArray
MsgBox(Join(brr, ","))
End Sub
string[] arr = { "a,23sd44", "a,23s5sf4", "bb,sd2364", "a,2f534", "bb,2sfds434" };
foreach (var str in arr.GroupBy(s => s.Split(',')[0]).Select(g => g.Last()))
{
Console.WriteLine(str);
}
Private DeviceCollection As new Dictionary(Of String, String)
If Not DeviceCollection.ContainsKey("a") Then
DeviceCollection.Add("a",value)
else
DeviceCollection.Item("a").value =value
end if