1
I have a DataGridView
in my project and a timer with refresh 5 seconds. I realized that the system was overloading the memory, as each time I listed the previous data remained in memory. This is the code I use to list:
Using (DBEntities db = new DBEntities())
{
Dgv_Os.Datasource = null;
List <OS> ostecnicos = (from o in db.OS select o).toList ();
Dgv_Os.Datasource = ostecnicos;
}
What methods to optimize code make the system lighter?
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero