I suppose this is a very silly question but I've been looking around and couldn't find answers on the following questions. Really appreciate answers shedding light on this.
1) What happens to the previous object if instantiating a new one within the same method. Example:
DataTable dataTable = new DataTable();
dataTable = new DataTable(); // Will the previously created object be destroyed and memory freed?
2) Same question as (1) but on static variable. Example:
static private DataView dataView;
private void RefreshGridView()
{
dataView = new DataView(GetDataTable()); // Will the previously created objects be destroyed and memory freed?
BindGridView();
}
Thanks!