.net应用程序的默认访问说明是什么 [英] what is default access specifier for .net application

查看:60
本文介绍了.net应用程序的默认访问说明是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要什么是整个整个.net应用程序的默认访问说明符.

i want what is default access specifier for hole entire .net application

推荐答案

应用程序中没有用于所有对象的说明符.
对于紧接在名称空间(即顶层)中的类和结构,默认访问说明符为internal
对于类中的类和结构,属性,字段,枚举和方法,它为private

但是,始终始终声明访问说明符是一个非常非常好的主意-这样您就不会犯错,并且它迫使您考虑哪种访问方式适合于此.

请参见 MDSN [
There is no one specifier for all objects within an application.
For classes and structs immediately within a namespace (i.e. at the top level) the default access specifier is internal
For classes and structs, properties, fields, enums and methods within a class it is private

However, it is a very, very good idea to absolutely state the access specifier at all times - that way you cannot make a mistake, and it forces you to think about what kind of access is appropriate for it.

See MDSN[^]


http://www.dotnetfunda.com/interview/exam425-default-access-modifiers -in-csharp.aspx [ ^ ]


这篇关于.net应用程序的默认访问说明是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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