[Note] I have used DataTable only for explaining. It can be any data type.
Usually we do the mistake of initializing unnecessarily like this.
Dim dt as New DataTable
DataTable dt= new DataTable();
We don’t have to initialize the dt variable here and it is unnecessary. Because we are overwriting it.
We can just declare the variable and then assign the value from the function or any other expressions.
Dim dt as DataTable
Dim dt as DataTable = CreateDataTable()
DataTable dt = CreateTable();