内部和私人有什么区别
在 F# 中,内部方法和私有方法有什么区别。
我有一种感觉,它们的实现是相同的,但含义不同。
In F# what is the difference between an internal method and a private method.
I have a feeling that they are implemented the same, but mean something different.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可以从同一 .NET 程序集中的任何类型(或函数)访问
内部
方法。private
方法只能从声明它的类型中访问。这是一个显示差异的简单片段:
An
internal
method can be accessed from any type (or function) in the same .NET assembly.A
private
method can be accessed only from the type where it was declared.Here is a simple snippet that shows the difference:
内部与公共相同,只是它仅在其声明的程序集中可见。私有仅在声明类型内部可见。
internal is the same as public, except that it is only visible inside the assembly it is delcared in. Private is only visible inside the declaring type.
内部实例可以在同一程序集中访问,而私有实例只能在定义中访问班级。
internal instances can be accessed throughout the same assembly, while private instances can be accessed "ONLY" in the defining class.