Click here to Skip to main content
16,005,339 members
Home / Discussions / C#
   

C#

 
AnswerRe: Operator Overloading Pin
Pete O'Hanlon7-Oct-07 10:38
mvePete O'Hanlon7-Oct-07 10:38 
AnswerRe: Operator Overloading Pin
Scott Dorman7-Oct-07 10:47
professionalScott Dorman7-Oct-07 10:47 
QuestionHow to determine best possible combination to a C# ListArray? Pin
humblepgmr6-Oct-07 4:10
humblepgmr6-Oct-07 4:10 
AnswerRe: How to determine best possible combination to a C# ListArray? Pin
humblepgmr6-Oct-07 4:47
humblepgmr6-Oct-07 4:47 
AnswerRe: How to determine best possible combination to a C# ListArray? Pin
Guffa6-Oct-07 6:25
Guffa6-Oct-07 6:25 
AnswerRe: How to determine best possible combination to a C# ListArray? Pin
lmoelleb6-Oct-07 6:33
lmoelleb6-Oct-07 6:33 
QuestionFinalize and Dispose Pin
Blumen6-Oct-07 2:29
Blumen6-Oct-07 2:29 
AnswerRe: Finalize and Dispose Pin
Simon P Stevens6-Oct-07 2:47
Simon P Stevens6-Oct-07 2:47 
In c# there's no such thing as a deterministic destructor like in c++. Instead you have a non-deterministic finaliser. If you include a finaliser in your class, when you have finished with the object it will be placed in the finalisation queue, and the finailise method will get called next time garbage collection is run.

This means that your objects may hang around for quite a while, hogging up memory, or holding onto resources, so to help things along we use the dispose pattern which allows us to ensure that objects gets cleared up quickly and finislisation doesn't have to happen. The dispose method should clean up all resourses, and supress finalisation, while the finaliser method should only clear up _unmanaged_ resources. This is becuase the finaliser may get called much later on, so other managaed resources may already have been destoryed, so you mustn't risk referencing them again.

You can then call the dispose method manually when you have finished with the object (or use the "Using" keyword to ensure it gets called)

To read about the dispose pattern check out this site:
http://msdn2.microsoft.com/en-us/library/b1yfkh5e.aspx

See this page for more about the "Using" keyword
http://msdn2.microsoft.com/en-us/library/yh598w02.aspx

Hope that helps.


Simon

GeneralRe: Finalize and Dispose Pin
Blumen6-Oct-07 3:39
Blumen6-Oct-07 3:39 
AnswerRe: Finalize and Dispose Pin
Guffa6-Oct-07 4:12
Guffa6-Oct-07 4:12 
AnswerRe: Finalize and Dispose Pin
Abhijit Jana6-Oct-07 2:49
professionalAbhijit Jana6-Oct-07 2:49 
AnswerRe: Finalize and Dispose Pin
Scott Dorman7-Oct-07 10:52
professionalScott Dorman7-Oct-07 10:52 
QuestionTree View Manipulation. Pin
M. J. Jaya Chitra6-Oct-07 1:50
M. J. Jaya Chitra6-Oct-07 1:50 
AnswerRe: Tree View Manipulation. Pin
Simon P Stevens6-Oct-07 3:05
Simon P Stevens6-Oct-07 3:05 
QuestionHow to log before window shutdowned! Pin
tranglt6-Oct-07 1:26
tranglt6-Oct-07 1:26 
AnswerRe: How to log before window shutdowned! Pin
Anthony Mushrow6-Oct-07 1:47
professionalAnthony Mushrow6-Oct-07 1:47 
AnswerRe: How to log before window shutdowned! Pin
Abhijit Jana6-Oct-07 2:26
professionalAbhijit Jana6-Oct-07 2:26 
QuestionClient-Server [modified] Pin
Aamu6-Oct-07 1:05
Aamu6-Oct-07 1:05 
QuestionThreading Pin
udikantz6-Oct-07 0:46
udikantz6-Oct-07 0:46 
AnswerRe: Threading Pin
lmoelleb6-Oct-07 1:00
lmoelleb6-Oct-07 1:00 
GeneralRe: Threading Pin
udikantz6-Oct-07 1:52
udikantz6-Oct-07 1:52 
GeneralRe: Threading Pin
lmoelleb6-Oct-07 3:35
lmoelleb6-Oct-07 3:35 
GeneralRe: Threading Pin
udikantz6-Oct-07 6:16
udikantz6-Oct-07 6:16 
Questionhow to check the files are exist or not in a floder Pin
ramyanaidu5-Oct-07 22:45
ramyanaidu5-Oct-07 22:45 
AnswerRe: how to check the files are exist or not in a floder Pin
Hessam Jalali5-Oct-07 23:03
Hessam Jalali5-Oct-07 23:03 

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.