[VB.NET TIPS] Tips for basic data types

1. Type character
Sometimes it is necessary to directly add the type character to specify the type clearly. The commonly used type characters are listed below< /p>

Type Character
Short S
Integer I
Long L
Decimal D
Char c
Single F
Double R
Octal Leading&O
Hexadecimal Leading&H

2.Decimal data type
When writing a program, use the Decimal data type to represent decimals. This is a precision Types of.
Single, Double are floating point decimals and are approximate values. Different results may occur on different CPU platforms.
The same is true in the database, Decimal should be used for the decimal field, otherwise you will get unexpected results.
Most CPU platforms have special methods for processing floating-point numbers, but there is no specific method for the Decimal data type, so Decimal is slower to process than floating-point numbers and takes up more space.

3.String data type
The default value of String is Nothing, but VB.NET will treat Nothing as Treat as empty string.

4.Object data type
The default value of Object is Nothing, but when the Object variable whose value is Nothing is converted to other basic types , Nothing will be converted to the default value of the target type.

5.Boolean data type Boolean can be converted with numeric types, but all conversions are considered contraction conversions. True is converted to -1, False is converted to 0. For the Byte type, True is converted to 255.

Leave a Comment

Your email address will not be published.