JornWildt / Ramone

A C# client framework for consuming HTTP/REST services
Other
61 stars 11 forks source link

Adding IDisposable to Response #1

Closed prearrangedchaos closed 12 years ago

prearrangedchaos commented 12 years ago

In order to close a connection you would have to do something like this:

Request req = this._session.Bind(...); Response response = req.Post(...); ... response.WebResponse.Close();

With this update it would be: In order to close a connection you would have to do something like this:

Request req = this._session.Bind(...); using (Response response = req.Post(...)) { ... }

JornWildt commented 12 years ago

Thanks a lot! And I am the one who have just been writing with capital letters inside my own organization: REMEMBER "USING" FOR STREAMS!!!! Duh, thanks for telling me. Will include!

And just to make my self remember it, I'll write it, well, almost, a hundred times here ...

I MUST ALWAYS REMEMBER "USING" FOR STREAMS! I MUST ALWAYS REMEMBER "USING" FOR STREAMS! I MUST ALWAYS REMEMBER "USING" FOR STREAMS! I MUST ALWAYS REMEMBER "USING" FOR STREAMS! I MUST ALWAYS REMEMBER "USING" FOR STREAMS! ... ... I MUST ALWAYS REMEMBER "USING" FOR STREAMS! I MUST ALWAYS REMEMBER "USING" FOR STREAMS! I MUST ALWAYS REMEMBER "USING" FOR STREAMS!

JornWildt commented 12 years ago

You should also upgrade to later versions of Ramone - I am going through all the test cases and other examples in order to find unclosed connections - and finding more issues with the Ramone core (and fixing them).