The note of learning basic data types of ASP. NET [9]. NET and common methods
Source: Internet
Author: User
The basic data types of. NET are defined under the system namespace, and their classes are defined as integer variables.
Sbyte-system. sbyte range:-128 to 127 byte-system. byte range: 0 to 256
Short-system. int16 range:-32768 to 32767 ushort-system. uint16 range: 0 to 65535
INT-system. int32 ranges from-2,147,483,648 to 2,147,483,647 uint-system. the value range of uint32 is 0 to 4,294,967,295 long-system. the int64 range is-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 ulong-system. uint64 ranges from 0 to 18,446,744,073,709,551,615.
--- Common methods and constants:Maxvalue and minvalue indicate the maximum and minimum values of the current type, that is, the range written above. The call method is called using the actual class. For example, system. int32.maxvaluetostring () is a very useful method. We use this method to output numbers to the desired format, for example:
Int A = 123456789; system. console. write (. tostring (); by default, the system is output normally. console. write (. tostring ("G"); by default, the system is output normally. console. write (. tostring ("D"); the output is in decimal format. console. write (. tostring ("N"); the output is in the numerical form, that is, 123,456,789 system. console. write (. tostring ("C"); the output is in the currency format $1,000.00 system. console. write (. tostring ("H"); the output is a hexadecimal floating point variable float-system. in general, single only keeps 7 valid digits. All digits that exceed the seventh digit are recorded as 0. For example, we assign a float value of 8888888888 (a total of 10 digits ). ), When we output the data, the number will be changed to 8888889000.00. For example, if the output is 0.8888888888 double-system. Double, the value of 15 is a valid number. Decimal-system. Decimal generally holds 28 as valid numbers.
--- Common decimal type methods:Truncate returns the integer value round returns the rounded integer value, or adds the decimal number parameter to return the rounded to decimal number. Example: decimal. round (55.6) returns 56 decimal. round (55.844, 2) returns the ceiling, the largest integer less than the decimal variable, and the smallest integer character type char-system. char stores character encoding in the range of 0 to 65536, where 0 to 127 is the standard ASCII code
--- Common methodsConvertfromutf32 (82) This method returns 'R' converttoutf32 ("r", 0) and returns 82
Iscontrol is used to determine whether the character is a carriage return or line feed, isdigit, a control character such as tab, determines whether it is a digital isletter, determines whether it is a letter, isletterordigit, determines whether it is a digit, or islower, determines whether it is a lower-case form, and isupper determines whether it is an upper-case is punctuation isseparator determines whether it is a space or other separator issymbol determines whether it is a symbol like +-iswhitespace determines whether it is a blank character, for example, true is returned for both spaces and carriage returns, while false is returned for tab returns string-type string-system. string.. Net strings can use the Escape Character "/" like other programming languages. If a string contains "/" or, we can also use @ to avoid using escape characters. For example, we need a file path string. Can we write @ "C:/program files/anyfiles/c.txt ". If @ is not used, we need to write it as "C: // program files // anyfiles // c.txt ". When the string contains "", we can also use @, but note that "" needs to be written twice. Boolean bool-system. boolean values are 1 (true) or 0 (false). The object type-system. object can contain any other type of data type variables or other objects. But for the object variable itself, it does not save the content of the entire object, but only saves a reference of the actual object in a memory. If the actual object is a TV, our object variable itself is a remote control, providing a way to find the object in the memory.
--- Common methods:GetType is used to return the object type.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service