具有所有静态方法的常规类IS最初还将通过其应用程序加载到内存中. [英] IS the normal class with all static method will also load into memory initially with its application.

查看:79
本文介绍了具有所有静态方法的常规类IS最初还将通过其应用程序加载到内存中.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Q1-标记为static的类是否仅在最初与应用程序一起加载到内存中.或者将所有方法都设为静态的普通类也将首先通过其应用程序加载到内存中.

Q1--Are the classes marked as static only gets loaded initially with the application into memory. Or the normal class having all the method as static will also be loaded initially into memory with its application.

第2季度-是对静态呼叫的全部调用方法是从内存中的已加载类呈现还是返回HDD?

Q2--is all the call to a static  method is rendered from loaded class in the memory or it goes back to HDD?

推荐答案

静态类和非静态类之间的唯一区别-static类是第一个被标记为抽象的类,因此CLR阻止您实例化它并对其进行密封,以便CLR阻止您继承它.对于其他所有 方面,所有成员都是静态的静态类和非静态类之间没有区别.

The only difference between a static class and a non-static class is that the first is marked as being abstract, so that the CLR prevents you from instantiating it, and sealed, so that the CLR prevents you from inheriting from it. For all other aspects, there is no difference between a static class and a non-static class with all members static.

另一件事.静态类不能具有任何构造函数,而抽象类或密封类则可以.

one other thing. A static class cannot have any constructor, while an abstract class or a sealed class can.


这篇关于具有所有静态方法的常规类IS最初还将通过其应用程序加载到内存中.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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