Is the package private in C #?

In Java, a method that does not have a visibility keyword is called private and can be seen from objects in one package.

If the method or field does not have a visibility keyword in C #, then it is also a closed package, and if not, then visibility then?

And how can I make a field private in C #?

+3
source share
5 answers

by default, the class is marked as internalif not specified. In this case, only classes from the same assembly can be used.

In fact, this can be overridden using InternalsVisibleToAttribute, which allow you to authorize a specific assembly to view internal types

+8
source

, private # , .

.

+3

. . private ""

+2

# .

# Java "package-private", ; internal

. fooobar.com/questions/469998/...

+2

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


All Articles