internal vs public in c#

前端 未结 7 1116
野趣味
野趣味 2020-11-29 04:07

I want to know the difference between the public and internal visibility modifiers.

When should we use internal on a class and

7条回答
  •  时光取名叫无心
    2020-11-29 05:01

    internal is also useful when writing unit tests. The InternalsVisibleTo attribute let's your test assembly access internal methods in your code assembly. I.e. you can test methods that appear private to the outside world without using reflection.

提交回复
热议问题