Asp.net c # detailed description of value types and reference types

Source: Internet
Author: User

Asp tutorial. net c # value type and reference type
C # has two types: value type and reference type ).

Variables of the value type directly contain their data, while variables of the reference type store references to their data. The latter is called an object.
For the reference type, two variables may reference the same object. Therefore, operations on one variable may affect the objects referenced by another variable.
For value types, each variable has its own data copy (except for the ref and out parameter variables). Therefore, operations on one variable cannot affect another variable.
C # values are further divided into simple type, enum type, struct type, and nullable type ).
The reference types of c # are further divided into class type, interface type, array type, and delegate type ).
The following table provides an overview of the c # type system.

Category
Description
 
Value Type
Simple Type
Signed integer: sbyte, short, int, and long
 
Unsigned integer: byte, ushort, uint, and ulong
 
Unicode Character Type: char
 
Ieee floating point: float and double
 
Decimal type with High Precision
 
Boolean: bool
 
Enumeration type
User-Defined type in the form of enum e {...}
 
Structure Type
User-Defined type in the form of struct s {...}
 
It can be a null type.
All other extensions with null values
 
Reference Type
Class type
Other types of final base class: object
 
Unicode string: string
 
User-Defined type in the form of class c {...}
 
Interface Type
User-Defined type in the form of interface I {...}
 
Array type
One-dimension and multi-dimensional arrays, such as int [] and int [,]
 
Delegate type
For example, a user-defined type in the form of delegate int d (...)
 

The eight integer types support 8-bit, 16-bit, 32-bit, and 64-bit integer values in signed and unsigned forms.

Two floating point types: float and double, which are expressed in the ieee 754 format with 32-bit single precision and 64-bit double precision, respectively.

The decimal type is a 128-bit data type and is suitable for finance and currency computing.

The bool type of c # is used to indicate the Boolean value-true or false.

In c #, character and string processing uses unicode encoding. The char type represents a UTF-16 encoding unit, and the string type represents a sequence of UTF-16 encoding units.

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.