In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces what the VB.NET special characters are, which are very detailed and have certain reference value. Friends who are interested must finish reading them.
Sometimes you need to use special characters in your code, that is, characters that are not in the standard alphanumeric table. Punctuation and special characters in the Visual Basic character set have their own uses, ranging from organizing program text to defining tasks performed by a compiler or compiled program. They do not specify the action to be performed.
Parentheses for VB.NET special characters
Use parentheses when defining procedures, such as Sub or Function. The list of all procedure parameters must be placed in parentheses. Parentheses can also be used to logically group variables or parameters, especially to override the default precedence of operators in complex expressions. The following example illustrates this.
Visual Basic Dim a, b, c, d, e As Double a = 3.2b = 7.6c = 2d = b + c / an e = (b + c) / a
After executing the previous code, the value of d is 8.225 and the value of e is 3. The default priority order, first / later +, is used when calculating d, which is equivalent to d = b + (c / a). The parentheses used when calculating the e value override the default priority.
Delimiters for VB.NET special characters
As the name implies, delimiters are used to separate parts of the code. The delimiter in Visual Basic is a colon (:). You can use delimiters when you want to place multiple statements on one line instead of multiple lines to save space and enhance the readability of your code. The following example shows three statements separated by a colon (:).
Visual Basic a = 3.2b = 7.6c = 2
Concatenation of VB.NET special characters
The & operator is used to "concatenate" or link strings together. Don't confuse it with the + operator, which is used to add values. Concatenating numeric values with the + operator may result in incorrect results. The following example illustrates this.
Visual Basic var1 = "10.01" var2 = 11 resultA = var1 + var2 resultB = var1 & var2
After executing the previous code, the value of resultA is 21.01 and the value of resultB is "10.0111".
Member access operator for VB.NET special characters
To access a member of a type, use a dot (.) between the type name and the member name. Or exclamation point (!) Operator.
The point of VB.NET special characters (.) Operator
Use a class, structure, interface, or enumeration in the form of a member access operator. Operator. Members can be fields, properties, events, or methods. The following example illustrates this.
Visual Basic Dim nextForm As New System.Windows.Forms.Form 'Access Text member (property) of Form class (on nextForm object). NextForm.Text = "This is the next form" 'Access Close member (method) on nextForm. NextForm.Close ()
Exclamation point (!) for VB.NET special characters Operator
You can only use the Dictionary access operator on a class or interface! Operator. The class or interface must have a default property that accepts a single String parameter. ! The identifier immediately following the operator becomes the string parameter of the default property. The following example illustrates this.
Visual Basic Public Class hasDefault Default Public ReadOnly Property index (ByVal s As String) As Integer Get Return 32768 + AscW (s) End Get End Property End Class Public Class testHasDefault Public Sub compareAccess () Dim hD As hasDefault = New hasDefault () MsgBox ("Traditional access returns" & hD.index ("X") & vbCrLf & _ "Default property access returns" & hD ("X") & vbCrLf & _ "Dictionary access returns" & HDZ X) End Sub End Class
All three output lines of MsgBox show a value of 32856. The * line uses the traditional access to the attribute index, the second line takes advantage of the fact that index is the default property of the class hasDefault, and the third line uses dictionary access to the class.
Attention, please! The second Operand of the operator must be a string without double quotes ("). In other words, you cannot use strings or string variables. The following change to the line of the MsgBox call * * will result in an error because "X" is a string enclosed in quotation marks.
"Dictionary access returns" & hD! "X")
Be careful
References to the default collection must be explicit. In particular, you cannot use late-bound variables! Operator.
In VB.NET special characters! Characters can also be used as characters of type Single.
The above is all the content of the article "what are the VB.NET Special characters?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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: 277
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.