Click here to Skip to main content
15,923,389 members
Home / Discussions / C#
   

C#

 
QuestionDo SQL Transactions lock the database automatically ? Pin
emran83425-Feb-06 21:37
emran83425-Feb-06 21:37 
AnswerRe: Do SQL Transactions lock the database automatically ? Pin
Colin Angus Mackay25-Feb-06 22:17
Colin Angus Mackay25-Feb-06 22:17 
GeneralRe: Do SQL Transactions lock the database automatically ? Pin
emran83425-Feb-06 23:34
emran83425-Feb-06 23:34 
GeneralRe: Do SQL Transactions lock the database automatically ? Pin
Colin Angus Mackay26-Feb-06 0:06
Colin Angus Mackay26-Feb-06 0:06 
GeneralRe: Do SQL Transactions lock the database automatically ? Pin
emran83426-Feb-06 1:20
emran83426-Feb-06 1:20 
QuestionDestructors~~~~ Pin
2hdass25-Feb-06 21:33
2hdass25-Feb-06 21:33 
AnswerRe: Destructors~~~~ Pin
Le centriste25-Feb-06 21:51
Le centriste25-Feb-06 21:51 
AnswerRe: Destructors~~~~ Pin
Guffa25-Feb-06 21:59
Guffa25-Feb-06 21:59 
No, it wont. The destructor will be called when the garbage collector is about to remove the object.

If you want some clean up in the object, let the class inherit the IDisposable interface. When you are done with the object, call the Dispose method to do the clean up.

A good way of disposing of objects is using the using keyword. That will create a try...finally block with the Dispose call in the finally part. That ensures that the Dispose method is always called, whatever happens.

Class A {
	... //omitted code
	private void methodA () {
		using (B b = new B()) {
			... //do something
		} // here B will be automattically disposed
	}
}

Class B : IDisposable {
	... //omitted code
	~B() {
		this.Dispose(); // fallback, in case you forget to call Dispose
	}
	public void Dispose() {
		... // the clean up
	}
}



---
b { font-weight: normal; }

Questionenum being int Pin
2hdass25-Feb-06 21:08
2hdass25-Feb-06 21:08 
AnswerRe: enum being int Pin
darkelv25-Feb-06 21:30
darkelv25-Feb-06 21:30 
QuestionCustomizing install wizard Pin
2hdass25-Feb-06 20:58
2hdass25-Feb-06 20:58 
QuestionGet info from a listview and pass to a method ? Pin
autekre25-Feb-06 20:17
autekre25-Feb-06 20:17 
AnswerRe: Get info from a listbox and pass to a method ? Pin
darkelv25-Feb-06 20:45
darkelv25-Feb-06 20:45 
GeneralRe: Get info from a listbox and pass to a method ? Pin
autekre25-Feb-06 21:58
autekre25-Feb-06 21:58 
GeneralRe: Get info from a listbox and pass to a method ? Pin
autekre25-Feb-06 22:15
autekre25-Feb-06 22:15 
GeneralRe: Get info from a listbox and pass to a method ? Pin
darkelv25-Feb-06 22:21
darkelv25-Feb-06 22:21 
GeneralRe: Get info from a listbox and pass to a method ? Pin
autekre27-Feb-06 0:27
autekre27-Feb-06 0:27 
QuestionEdit Mode in DataGridView control Pin
ak1234525-Feb-06 18:36
ak1234525-Feb-06 18:36 
QuestionNewbie: How do I code on more than one file? Pin
DNA Code this!25-Feb-06 18:04
DNA Code this!25-Feb-06 18:04 
AnswerRe: Newbie: How do I code on more than one file? Pin
Sean8925-Feb-06 18:08
Sean8925-Feb-06 18:08 
GeneralRe: Newbie: How do I code on more than one file? Pin
DNA Code this!25-Feb-06 18:13
DNA Code this!25-Feb-06 18:13 
GeneralRe: Newbie: How do I code on more than one file? Pin
Sean8925-Feb-06 18:27
Sean8925-Feb-06 18:27 
AnswerRe: Newbie: How do I code on more than one file? Pin
DNA Code this!25-Feb-06 18:33
DNA Code this!25-Feb-06 18:33 
GeneralRe: Newbie: How do I code on more than one file? Pin
DNA Code this!25-Feb-06 18:38
DNA Code this!25-Feb-06 18:38 
QuestionHow can I do this?"open with" Pin
hackerhcm25-Feb-06 17:55
hackerhcm25-Feb-06 17:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.