Q about a StreamReader defined in a function

Hey guys,

I'm trying to access the reddit api to learn the platform my employers are working with. I've managed to get, display and filter posts, and am currently working on authorization. To test my auth method, I currently have this line:

Console.WriteLine(new StreamReader(AuthResponse.GetResponseStream())); 

Now, I was wondering – what happens to this StreamReader? Is there a way to close it or does it close automatically after the WriteLine? Can I name it in the WriteLine?

Kind regards,
Boogy

by Boogy via /r/csharp

Leave a Reply