开发者

VB.NET - Remove Item From Multi-Dimensional ArrayList By Query?

I am looking to remove an element from an ArrayList using a query, E.g. DELETE FROM arraylist WHERE (0) = "User1" (Where (0) is the index of the second dimension).

Code:

Dim Users As New ArrayList
Users.Add({"User0", "Details"})
Users.Add({"U开发者_StackOverflow社区ser1", "Details"})
Users.Remove("User1")

The reason I am looking for a query way to do this is because I will not know what the second dimension value will be.


Dim Users As New ArrayList
Users.Add(new String(){"User0", "Details"})
Users.Add(new String(){"User1", "Details"})
Dim userToRemove = Users.Cast(Of String()).Where(Function(i) i(0).Equals("User1")).Single()

Users.Remove(userToRemove)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜