Class vs. Public Class

前端 未结 3 1552
一个人的身影
一个人的身影 2020-12-23 11:28

What is the difference between:

namespace Library{
    class File{
        //code inside it
   }
}

and:

namespace Library{
         


        
3条回答
  •  半阙折子戏
    2020-12-23 11:52

    Without specifying public the class is implicitly internal. This means that the class is only visible inside the same assembly. When you specify public, the class is visible outside the assembly.

    It is also allowed to specify the internal modifier explicitly:

    internal class Foo {}
    

提交回复
热议问题