上课与公开课的区别 [英] Difference between class and Public class

查看:192
本文介绍了上课与公开课的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道类和公共类之间的区别.

I want to know difference between class and public class.

推荐答案

请参见 ^ ].


在C#中,默认情况下,一个类具有内部访问权限(即,该类仅在程序集中可见).
一个公共类将有权访问它所属于的程序集以及引用它的所有其他程序集.
In C#, a class by default has internal access (i.e. this class is only visible within the assembly).
A public class will have access in the assembly it is part of and all other assemblies where it is referenced.


一个类的默认修饰符为Internal.因此,如果您声明类Eg
A class has default modifiers as Internal.So if u declare the class E.g
class ABC

将被视为

Internal Class ABC

因此,该类的范围仅在Assembly之内.....
但是,当您将类声明为

So,the Scope of that class is within the Assembly only.....
But,When u declare class like

Public Class ABC

时,则该类的范围在整个应用程序中都是可访问的,无论该应用程序是否在同一Assembly中.

then the scope of the class is Accessible within Whole the application whether its is in same Assembly or not.


这篇关于上课与公开课的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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