Thread: StreamReader/StreamWriter

  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,130
    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