Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use VB.NET Shared variable

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to use the VB.NET Shared variable. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

VB.NET is an object-oriented intermediate interpretive language based on Microsoft. NET Framework, which can be regarded as an upgraded version of VB on the .net Framework platform, which enhances the support for object-oriented. However, because the change is too big, the backward compatibility of VB.NET to VB is not good, which causes a lot of controversy in the industry.

Most VB.NET programmers use Visual Studio. Net as IDE (integrated development environment). SharpDevelop is another available open source IDE. VB.NET needs to be executed on the .net Framework platform. VB.NET 's home page http://msdn.microsoft.com/vbasic

As programmers know, a decorated Shared has been added to VB.NET. The Shared keyword indicates that one or more declared programming elements will be shared. The point is that shared elements are not associated with a specific instance of a class or structure. You need to access shared elements by using the class name or structure name or the variable name of a specific instance of the class or structure to qualify the shared elements. The simple description is that the Shared variable serves the type itself, not a specific object.

Examples of VB.NET Shared variables

Public Class TestA Public Shared i As Int32 = 10 End Class Public Class TestB Inherits TestA 'inherit TestA Public Sub New () TestA.i = 100' access the Shared variable End Sub End Class using the name of the type

It is important to note that the syntax requirements of VB.NET Shared variables in relation to types and instances do not seem particularly strict. Programmers can use instances of types to access and modify Shared variables, but they are very strict in C #.

This is the end of this article on "how to use VB.NET Shared variables". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report