iotaSingh iotaSingh - 5 months ago 63
C# Question

Can WebResponse.GetResponseStream() return a null?

i know its a noob question, but just wanted to know whether

can return null in any case?


Well, it's sort of up to the concrete subclass - but I've never seen any subclass which does so, and it's not documented as a valid return value. I've never seen any code written to defensively check for this, and I wouldn't expect to. That's not to say such code doesn't exist, but I don't think it's necessary.

If there's no content in the response (but the response was successful) I'd expect any good implementation to return an empty stream.