VB.NET中的静态类 [英] Static Classes in VB.NET

查看:135
本文介绍了VB.NET中的静态类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在VB.NET中创建静态类吗?如果是,请说明。我们可以从Static类派生一个新类吗?

Can we create a Static Class in VB.NET? If so, please illustrate. Can we derive a new class from Static class?

推荐答案

VB.NET < u>模块 s相当于 C# 静态类 es和不,你不能从模块派生(以及你不能从 C#静态类派生)。 />
您可以在 MSDN 文档中找到更好的上述信息。
VB.NET Modules are the equivalent of C# Static Classes and no, you cannot derive from a Module (as well as you cannot derive from a C# Static Class).
You may find all the above info better explained inside MSDN documentation.


您可以在vb中创建静态类.net



You can create static class in vb.net

Friend NotInheritable Class DB
        Public Shared AGE As Integer = 10
    End Class





在其他代码中使用AGE变量





Using AGE variable in other code

Dim myage As Integer = DB.AGE


A VB .NET模块相当于静态类。您不能从静态类继承,也不能从其他类继承。
A VB.NET Module is the equivalent of a static class. You cannot inherit from a static class nor can it be inherited from another class.


这篇关于VB.NET中的静态类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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