Wallace <pr****************@gmail.com> wrote:
Can anyone plz answer my question...
What is the difference between the following
1. DataTable dt = new DataTable();
2. DataTable dt;
and what is the use of each one...
Looking forward for the reply...
Both of them declare a variable called dt, the value of which is always
either a reference to a DataType (or derived type) or null.
In the first case, you're also creating a new DataTable and assigning
the reference to dt.
In the second case, either dt will be unassigned (and can't be read
until it's been definitely assigned) if it's a local variable, or will
have a value of null if it's a member variable.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too