|
-
Jun 8th, 2004, 10:37 AM
#1
Thread Starter
Lively Member
Close vs. Dispose...??
Which would be better to be used?
When I'm done with a form, should I just close it or dispose it?
How 'bout a data connection??
What are the advantages or disadvantages to using each??
Thanks
-
Jun 8th, 2004, 11:04 AM
#2
The close method does the work of dispose in some cases, but you should dispose it just to be on the safe side.
Same applies for ADO.NET.
Advantages: Better app performance
Disadvantages: I have no ****ing clue.
-
Jun 8th, 2004, 01:03 PM
#3
Sleep mode
Originally posted by spdracr
Which would be better to be used?
When I'm done with a form, should I just close it or dispose it?
How 'bout a data connection??
What are the advantages or disadvantages to using each??
Thanks
Dispose method works a little different in the different objects .
Forms :
1-Use Close() method (will close the form if it's not the startup form of your project)
Then
2-Dispose() , to clean up the space taken , and reclaim memory .
3-Set the form =Nothing . This de-reference any object that's connected to the form and mark it as out of scope for grabage collecting .
As for ADO.NET :
Same applies but more actions happen behind the scense like :
When you use dispose the OleDbConnection object , you're removing it from the connection pool (whether on the server or locally) .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|