Author: talldaniel | Posted on: 10/23/2008 11:07:48 AM | Views : 269

What is the difference between the declaration of an object with an assignment to null, and one which is  not assigned at all. 

In the examples below, the only difference is that myConnection is explicitly initialized to null in the second example.

What does it mean to explicitly assign to null?  is this different than just declaring, but not assigning?

Thanks,

 Example Method 1

SqlConnection myConnection;

try{

 ...
myConnection = new SqlConnection(connectionString);
} 

Example Method 2

Sq ...

Go to the complete details ...