VB.NET:“朋友"修饰符有什么作用? [英] VB.NET: what does the 'friend' modifier do?

查看:76
本文介绍了VB.NET:“朋友"修饰符有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VB.NET中的朋友"修饰符有什么作用?

What does the 'friend' modifier do in VB.NET?

为什么它是Visual Studio中GUI组件的默认修饰符?

Why is it the default modifier for GUI components in Visual Studio?

推荐答案

friend与C#中的internal相同,这意味着可以在同一程序集中的任何位置进行访问,但不能从同一程序集中进行访问.其他程序集.

friend in VB.Net is the same as internal in C#, it means that it can be accessed anywhere in the same assembly, but not from other assemblies.

我认为这是一个明智的默认设置,因为我会说通常一个程序集不应使用另一程序集的GUI控件(除非是为此目的而构建的类库或类似程序).

I think it's a sensible default since I would say that normally one assembly should not be using another assembly's GUI controls (unless it's a class library or similar that is built for the purpose).

这篇关于VB.NET:“朋友"修饰符有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆