Click here to Skip to main content
15,905,322 members
Home / Discussions / C#
   

C#

 
GeneralRe: Destructors Pin
Richard Andrew x641-Oct-13 16:29
professionalRichard Andrew x641-Oct-13 16:29 
GeneralRe: Destructors Pin
N8tiv1-Oct-13 16:31
N8tiv1-Oct-13 16:31 
GeneralRe: Destructors Pin
Richard Andrew x641-Oct-13 17:09
professionalRichard Andrew x641-Oct-13 17:09 
GeneralRe: Destructors Pin
Dave Kreskowiak1-Oct-13 17:05
mveDave Kreskowiak1-Oct-13 17:05 
GeneralRe: Destructors Pin
Richard Andrew x641-Oct-13 17:08
professionalRichard Andrew x641-Oct-13 17:08 
GeneralRe: Destructors Pin
Keith Barrow1-Oct-13 22:45
professionalKeith Barrow1-Oct-13 22:45 
GeneralRe: Destructors Pin
N8tiv1-Oct-13 19:56
N8tiv1-Oct-13 19:56 
AnswerRe: Destructors Pin
Ron Beyer1-Oct-13 17:48
professionalRon Beyer1-Oct-13 17:48 
Destructors are not magic and do not automatically clean up your resources by just putting the placeholder code there. If you allocate unmanaged objects YOU must un-allocate them.

However, I would advise reading up on the differences between using a destructor versus implementing IDisposable. Destructors in C# are very different than those in C++ and understanding when they are called and what they do is important in how you effectively use them.

See this StackOverflow answer[^] on using IDisposable and finalizers.

Note how the proper use of IDisposable helps you since you, the programmer, have almost no control when the finalizers are run, and absolutely no control about what order they run in (finalizers for unreferenced objects are not guaranteed to run in any particular order, and this could be important).
GeneralRe: Destructors Pin
jschell2-Oct-13 8:42
jschell2-Oct-13 8:42 
AnswerRe: Destructors Pin
Abhinav S1-Oct-13 21:12
Abhinav S1-Oct-13 21:12 
GeneralRe: Destructors Pin
Pete O'Hanlon1-Oct-13 21:58
mvePete O'Hanlon1-Oct-13 21:58 
QuestionEager Loading Problem Pin
eddieangel1-Oct-13 11:53
eddieangel1-Oct-13 11:53 
AnswerRe: Eager Loading Problem Pin
Mycroft Holmes1-Oct-13 12:54
professionalMycroft Holmes1-Oct-13 12:54 
GeneralRe: Eager Loading Problem Pin
eddieangel1-Oct-13 13:06
eddieangel1-Oct-13 13:06 
QuestionSending SMS Text Messages Pin
Kevin Marois1-Oct-13 5:35
professionalKevin Marois1-Oct-13 5:35 
AnswerRe: Sending SMS Text Messages Pin
Keith Barrow1-Oct-13 5:49
professionalKeith Barrow1-Oct-13 5:49 
QuestionHow to use WM_PASTE ? Pin
Mahmoud EL-Shazly1-Oct-13 0:49
Mahmoud EL-Shazly1-Oct-13 0:49 
AnswerRe: How to use WM_PASTE ? Pin
Sivaraman Dhamodharan1-Oct-13 2:14
Sivaraman Dhamodharan1-Oct-13 2:14 
GeneralRe: How to use WM_PASTE ? Pin
Mahmoud EL-Shazly1-Oct-13 9:29
Mahmoud EL-Shazly1-Oct-13 9:29 
AnswerRe: How to use WM_PASTE ? Pin
Richard MacCutchan1-Oct-13 3:07
mveRichard MacCutchan1-Oct-13 3:07 
AnswerRe: How to use WM_PASTE ? Pin
BillWoodruff1-Oct-13 3:26
professionalBillWoodruff1-Oct-13 3:26 
GeneralRe: How to use WM_PASTE ? Pin
OriginalGriff1-Oct-13 6:01
mveOriginalGriff1-Oct-13 6:01 
GeneralRe: How to use WM_PASTE ? Pin
Mahmoud EL-Shazly1-Oct-13 9:35
Mahmoud EL-Shazly1-Oct-13 9:35 
AnswerRe: How to use WM_PASTE ? Pin
Simon_Whale1-Oct-13 3:30
Simon_Whale1-Oct-13 3:30 
QuestionOOPS, deisgn patterns and principles Pin
Govindaraj Rangaraj1-Oct-13 0:25
Govindaraj Rangaraj1-Oct-13 0:25 

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.