Friend vs public for vb.net forms

Is it better to use virtual or public forms in vb.net? What are the benefits of each?

I notice when you import a vb6 project, the forms come in as a friend, but when you add a new form to vb.net, it is publicly available. I did not see any difference in how they work, so I have to miss something.

+3
source share
3 answers

VB6 did not support exporting forms from the class library. The natural mapping for the converted code is Friend. However, VB.NET has no such problems. Using Public is fine, assuming any public types in the public method arguments are also Public. Easy to find, the compiler will tell you.

+4
source

-, Friend (aka internal #), . private , , VB . , / , . , - (, ..).

, , . . InternalsVisibleToAttribute.

+7

Public, (.exe). Friend, . VB.NET.

Winforms, , , . , , .

, Microsoft, , "", , Visual Studio ( ) Public, .NET . .

+3

Source: https://habr.com/ru/post/1729027/


All Articles