Click here to Skip to main content
15,887,434 members
Home / Discussions / C#
   

C#

 
GeneralRe: Using "using" Pin
led mike6-May-08 4:40
led mike6-May-08 4:40 
GeneralRe: Using "using" Pin
#realJSOP7-May-08 0:02
mve#realJSOP7-May-08 0:02 
GeneralRe: Using "using" Pin
Pete O'Hanlon7-May-08 9:36
mvePete O'Hanlon7-May-08 9:36 
GeneralRe: Using "using" Pin
Spacix One7-May-08 11:08
Spacix One7-May-08 11:08 
AnswerRe: Using "using" Pin
N a v a n e e t h6-May-08 4:23
N a v a n e e t h6-May-08 4:23 
AnswerRe: Using "using" Pin
led mike6-May-08 4:31
led mike6-May-08 4:31 
GeneralRe: Using "using" Pin
Roger Alsing6-May-08 7:10
Roger Alsing6-May-08 7:10 
AnswerRe: Using "using" Pin
Guffa6-May-08 4:37
Guffa6-May-08 4:37 
John Simmons / outlaw programmer wrote:
I realize that this ensures that everything will be properly closed and disposed without you having to do anything, but doesn't the same thing happen when the object goes out of scope?


No, it doesn't. The memory management doesn't use reference counting, which means that nothing happens because of an object going out of scope.

Because there is no possibility to add any code that will run when the object goes out of scope, the IDisposable interface was created, so that the lifetime of an object could be controlled from the code.

Ordinary objects that doesn't have a specific need for any cleanup, doesn't have a Dispose method. They will just be removed when the garbage collector notices that the can be.

Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: Using "using" Pin
Roger Alsing6-May-08 7:45
Roger Alsing6-May-08 7:45 
GeneralRe: Using "using" Pin
Guffa6-May-08 9:53
Guffa6-May-08 9:53 
AnswerRe: Using "using" Pin
S. Senthil Kumar6-May-08 4:43
S. Senthil Kumar6-May-08 4:43 
AnswerRe: Using "using" Pin
DavidNohejl6-May-08 4:50
DavidNohejl6-May-08 4:50 
GeneralRe: Using "using" Pin
Pete O'Hanlon6-May-08 9:01
mvePete O'Hanlon6-May-08 9:01 
AnswerRe: Using "using" Pin
PIEBALDconsult6-May-08 5:25
mvePIEBALDconsult6-May-08 5:25 
GeneralRe: Using "using" Pin
Spacix One6-May-08 10:20
Spacix One6-May-08 10:20 
GeneralRe: Using "using" Pin
PIEBALDconsult6-May-08 12:24
mvePIEBALDconsult6-May-08 12:24 
QuestionConverting ActiveDirectory createTimeStamp to DateTime [modified] Pin
scotlfs6-May-08 3:59
scotlfs6-May-08 3:59 
AnswerRe: Converting ActiveDirectory createTimeStamp to DateTime Pin
scotlfs6-May-08 4:38
scotlfs6-May-08 4:38 
QuestionEnums and text descriptions Pin
MrEyes6-May-08 3:41
MrEyes6-May-08 3:41 
AnswerRe: Enums and text descriptions Pin
CPallini6-May-08 3:48
mveCPallini6-May-08 3:48 
AnswerRe: Enums and text descriptions Pin
J4amieC6-May-08 3:49
J4amieC6-May-08 3:49 
GeneralRe: Enums and text descriptions Pin
MrEyes6-May-08 4:13
MrEyes6-May-08 4:13 
GeneralRe: Enums and text descriptions Pin
J4amieC6-May-08 4:17
J4amieC6-May-08 4:17 
GeneralRe: Enums and text descriptions Pin
MrEyes6-May-08 5:01
MrEyes6-May-08 5:01 
GeneralRe: Enums and text descriptions Pin
PIEBALDconsult6-May-08 5:34
mvePIEBALDconsult6-May-08 5:34 

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.