要删除 list 中选中的内容,可以使用 Remove 方法。Remove 方法需要传入要删除的元素作为参数。
以下是一个示例代码:
' 创建一个 ListDim myList As New List(Of String)myList.Add("apple")myList.Add("banana")myList.Add("orange")' 输出当前 List 的内容Console.WriteLine("当前 List 的内容:")For Each item As String In myList Console.WriteLine(item)Next' 用户选择要删除的元素的索引Console.Write("请选择要删除的元素的索引:")Dim index As Integer = CInt(Console.ReadLine())' 删除选中的元素myList.RemoveAt(index)' 输出删除后的 List 的内容Console.WriteLine("删除后的 List 的内容:")For Each item As String In myList Console.WriteLine(item)Next在以上示例中,用户需要输入要删除元素的索引,然后使用 RemoveAt 方法删除该元素。最后,输出删除后的 List 的内容。

