msdn 上的重载含义

发布于 2024-08-11 03:34:28 字数 305 浏览 3 评论 0原文

我不明白重载术语在 msdn 库的 MemoryStream Close 方法(或其他类似 Dispose 方法)页面的上下文中意味着什么。

请参阅此处页面。 对我来说,重载指出这样一个事实:您提供的方法与现有方法具有相同的名称但签名不同,并且位于同一类中。

在这种情况下,不存在现有的 Close 方法。难道不应该被覆盖吗?谢谢!

I don't understand what does the overloaded term mean in the context of msdn library's page for MemoryStream Close method (or others like Dispose).

See the page here.
To me, overloaded points out the fact that you are providing a method with the same name but different signature than an existing one AND in the same class.

In this case, there's no existing Close method. Shouldn't it be override instead? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌面超妹 2024-08-18 03:34:28

嗯...它看起来更像是一个 MSDN 故障。据我所知,MemoryStream 不会覆盖、重载或重新声明(newClose() 方法。说实话,不知道 MSDN 在做什么。

我想知道这种区别是否仅出于文档目的而存在,因为 MemoryStream 没有非托管资源(实际上底层缓冲区仍然可用)。

关闭当前流并释放与当前流关联的所有资源(例如套接字和文件句柄)。

关闭读写流。

不过,它确实覆盖了Dispose(bool)

Hmm... it looks more like an MSDN glitch. From what I can see MemoryStream doesn't override, overload or re-declare (new) the Close() method. Not sure what MSDN is up to, to be honest.

I wonder if this distinction only exists for documentation purposes, because there are no unmanaged resources for a MemoryStream (and indeed the underlying buffer is still available).

Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream.

vs

Closes the stream for reading and writing.

it does override Dispose(bool), though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文