2009-12-23 22 views

回答

1

假設您有一個名爲listBox1的列表框。如果您想從中刪除所選項目,請使用Items.Remove()方法,並將SelectedItem屬性作爲參數傳遞。 用於添加實體Items.Add()並將其作爲要插入的值傳遞。

4
var yourList = new Collection<EntityType>(); 

yourList.Remove(entity); 
yourList.Add(otherEntity); 

或更換:

yourList[yourList.IndexOf(entity)] = otherEntity; 
相關問題