StreamReader/StreamWriter

This is a discussion on StreamReader/StreamWriter within the C# Programming forums, part of the General Programming Boards category; Hello everyone, I understand there is no need to call Dispose explicitly when dealing with StreamReader/StreamWriter object instances since GC ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    StreamReader/StreamWriter

    Hello everyone,


    I understand there is no need to call Dispose explicitly when dealing with StreamReader/StreamWriter object instances since GC will take care of it in Finalizer method.

    My question is, I want to know the benefits and potential issues of using "using" statement to deal with StreamReader/StreamWriter.


    thanks in advance,
    George

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    When using a "using"-block, the underlying file is closed at a set time, not at some time in the future the GC sees fit.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21