Click here to Skip to main content
15,902,777 members
Home / Discussions / C#
   

C#

 
AnswerRe: Easy way to create a save/load functionality to an Application Pin
Dave Kreskowiak5-May-09 17:23
mveDave Kreskowiak5-May-09 17:23 
QuestionWinForms Comboboxes Pin
Illegal Operation5-May-09 13:32
Illegal Operation5-May-09 13:32 
AnswerRe: WinForms Comboboxes Pin
dotnetmember5-May-09 16:42
dotnetmember5-May-09 16:42 
AnswerRe: WinForms Comboboxes Pin
Mycroft Holmes5-May-09 17:24
professionalMycroft Holmes5-May-09 17:24 
QuestionTo Dispose() or not Dispose(), that is the question. Pin
Peter Trevor5-May-09 13:02
Peter Trevor5-May-09 13:02 
AnswerRe: To Dispose() or not Dispose(), that is the question. Pin
Luc Pattyn5-May-09 13:25
sitebuilderLuc Pattyn5-May-09 13:25 
GeneralRe: To Dispose() or not Dispose(), that is the question. Pin
fly9045-May-09 14:22
fly9045-May-09 14:22 
GeneralRe: To Dispose() or not Dispose(), that is the question. Pin
Luc Pattyn5-May-09 14:47
sitebuilderLuc Pattyn5-May-09 14:47 
fly904 wrote:
Would setting it to null do/be the same?


setting a reference to null removes one reference to some object. If that happened to be the last live reference, the object becomes collectable, which does not free any memory yet, since the GC has to run first to discover that. And it does not close a file, does not free other managed resources, and does not free any unmanaged resources, say memory that got malloced in native code, will not get freed ever if there is no Dispose(); BTW: Windows will clean up everything when the process exits.

If a Dispose exists but is not called by your code, it will get called by the GC when the object gets finalized, which may be much later. Do you want to keep the large memory footprint longer than necessary, do you want to keep files open longer then necessary, ...? I don't think so.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in


JokeRe: To Dispose() or not Dispose(), that is the question. Pin
fly9045-May-09 15:24
fly9045-May-09 15:24 
GeneralRe: To Dispose() or not Dispose(), that is the question. Pin
Luc Pattyn5-May-09 15:42
sitebuilderLuc Pattyn5-May-09 15:42 
QuestionExpose Property of Constituent Control in UserControl Pin
xfitr25-May-09 11:18
xfitr25-May-09 11:18 
AnswerRe: Expose Property of Constituent Control in UserControl Pin
Christian Graus5-May-09 12:26
protectorChristian Graus5-May-09 12:26 
GeneralRe: Expose Property of Constituent Control in UserControl Pin
xfitr26-May-09 3:47
xfitr26-May-09 3:47 
JokeSolve this...... Pin
Rajdeep.NET is BACK5-May-09 9:09
Rajdeep.NET is BACK5-May-09 9:09 
GeneralRe: Solve this...... Pin
Luc Pattyn5-May-09 9:19
sitebuilderLuc Pattyn5-May-09 9:19 
GeneralRe: Solve this...... Pin
harold aptroot5-May-09 9:27
harold aptroot5-May-09 9:27 
RantRe: Solve this...... Pin
fly9045-May-09 9:25
fly9045-May-09 9:25 
GeneralRe: Solve this...... Pin
harold aptroot5-May-09 9:30
harold aptroot5-May-09 9:30 
GeneralRe: Solve this...... Pin
EliottA5-May-09 11:24
EliottA5-May-09 11:24 
GeneralRe: Solve this...... Pin
Dave Kreskowiak5-May-09 9:59
mveDave Kreskowiak5-May-09 9:59 
GeneralRe: Solve this...... Pin
CPallini5-May-09 10:53
mveCPallini5-May-09 10:53 
GeneralRe: Solve this...... Pin
Pete O'Hanlon5-May-09 11:22
mvePete O'Hanlon5-May-09 11:22 
GeneralRe: Solve this...... Pin
StarBP5-May-09 16:55
StarBP5-May-09 16:55 
QuestionPrinting Question - characters per line Pin
al3xutzu005-May-09 7:58
al3xutzu005-May-09 7:58 
AnswerRe: Printing Question - characters per line Pin
Dave Kreskowiak5-May-09 8:14
mveDave Kreskowiak5-May-09 8:14 

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.