来自梁列全的问题
在c#中,RemoveAt和Remove用法区别是什么?
在c#中,RemoveAt和Remove用法区别是什么?
1回答
2020-05-14 11:38
在c#中,RemoveAt和Remove用法区别是什么?
在c#中,RemoveAt和Remove用法区别是什么?
删除DataRow:有两种方法可以删除DataRow,Delete方法和Remove方法和RemoveAt方法.其区别是Delete方法实际上不是从DataTable中删除掉一行,而是将其标志为删除,仅仅是做个记号,而Remove方法则是真正的从DataRow中删除一行,RemoveAt方法是根本行的索引来删除.列:DataRowdr=ds.Tables[table].Rows.Find(a);ds.Tables[table].Remove(dr);或ds.Tables[table].Remove(index);//dr为a所在的行,查出后将其删除,index为a所在的索引号.关于DataSet中的其用法,参照MSDN