Assembly.GetManifestResourceStream(name) 在每次调用时都会返回一个新流吗?
文档 GetManifestResourceStream 不清楚对同一资源的多次调用。每次调用都保证一个独立的流实例吗?
原因:知道是否应该担心并发使用。
The documentation GetManifestResourceStream is not clear about multiple calls for the same resource. Does each call guarantee an independent stream instance?
Reason: know if one should worry about concurrent use.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以,是的。如果没有的话就很难使用了。
So, yes. It would be quite hard to use if it didn't.
鉴于流是有状态的,如果两个调用收到相同的 Stream 引用,我会感到非常惊讶。听到两个流都可以是同一位内存的视图,但应该对调用者隐藏,我不会感到惊讶。
我认为假设流是独立的是合理的。
Given that streams are stateful, I would be highly surprised if two calls received the same
Stream
reference. It would surprise me much less to hear that two streams could both be views onto the same bit of memory, but that should be hidden from the caller.I think it's reasonable to assume that the streams are independent.