开发者

Am I supposed to dispose redirected StandardOutput/StandardError

If I开发者_如何学C redirect StandardOutput/StandardError when creating a Process object, should I dispose the StreamReaders when I no longer need the Process object? Using reflector I see that Process.Dispose() does not do this for me (unless I'm missing something).


Yes the process object disposes of its own readers and their underlying streams. Redirected output retrieves a reader instance but the underlying stream is still managed by the processinfo which gets disposed automatically so no, you don't need to dispose of the reader.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜