B
Bob
Hi,
I know this has been discussed before and I have read the earlier posts but
I am still unclear.
I have code that was written in 1.1
Dim cmdConn As SqlClient.SqlCommand
Dim cmdSource As SqlClient.SqlDataReader
Dim other stuff
try
Instantiate the objects and do the business
Catch
logging error etc
Finally
cmdSource.Close()
cmdConn.Dispose()
End Try
Now in CLR 2.0 I am warned that the finally block is using unassigned
variables. (Which it is)
I am tempted to ditch the finally clause and leave it to the Garbage
collector.
What is the recommended code structure in this situation.
Thanks
Bob
I know this has been discussed before and I have read the earlier posts but
I am still unclear.
I have code that was written in 1.1
Dim cmdConn As SqlClient.SqlCommand
Dim cmdSource As SqlClient.SqlDataReader
Dim other stuff
try
Instantiate the objects and do the business
Catch
logging error etc
Finally
cmdSource.Close()
cmdConn.Dispose()
End Try
Now in CLR 2.0 I am warned that the finally block is using unassigned
variables. (Which it is)
I am tempted to ditch the finally clause and leave it to the Garbage
collector.
What is the recommended code structure in this situation.
Thanks
Bob