Why set it to null first ?
[EDIT]
there was this code about reading some file..it was like
StreamReader sr=null;
StreamReader sr= new StreamReader("file.txt");
I asked why would you set “SR” as null first BEFORE referencing the file u wanna read
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no need to do that…
in fact, the code above should give you a compile error as sr is already defined.
And you should probably write it as
in order to make sure it is properly disposed after usage (lookup IDisposable)