c# - Duplicates when trying to modify a DataTable List -


i'm working datatable list. want last item list, modify it, , add list new item. when values tblsol, items in list have same value. did go wrong?

list<datatable> tblsol = new list<datatable>();     int itr = 1;  //some code iterate these 3 lines below datatable = tblsol.last(); //some code here modify addtolist(now);  private void addtolist(datatable dt)     {         datatable temp = new datatable();         temp = dt;         tblsol.add(temp);         listbox1.items.add("iterasi" + itr);         itr++;     } 

if assign datatable datatable both same if require have same datatable can use copy method of datatable , add in list.

datatable temp = new datatable(); temp = dt.copy(); tblsol.add(temp); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -