C # basic data type classification
This article mainly explains "C# basic data type classification". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn the "C# basic data type classification"!
The value type in the C# basic data type stores its data content directly, while the reference type stores the reference of the object. These two types have different meanings to the assignment of variables.
Value types include: simple type, structure type, enumeration type; reference type includes: Object type, class type, interface, representative element, string type, array.
C # basic data type-example of value type
Int m = 0 × int n = m * * m = 1; / / at this time n is still 0, because the data of m and n are stored in different regional reference type examples
Class CFoo {public int n;}
Void Main () {CFoo F1 = new CFoo (); f1.n = 0; CFoo f2 = F1; f1.n = 1; / / at this time f2.n becomes 1, because the contents of f2 and F1 are of the same address} value type
The value types are: byte (1), sbyte (1), short (2), ushort (2), int (4), uint (4), long (8), ulong (8), float (4), double (8), decimal (8), char, bool, enumeration, structure.
The numbers in parentheses above indicate the number of bytes. Byte, ushort, uint, ulong are unsigned types (no negative numbers). By the way, sbyte is signed bytes.
These types are aliases for the .NET Framework type aliases, as indicated by String and string.
C # basic data type-reference type
Reference types are: object type, class type, interface, representative element, string type, array.
Although the string type (string) is a reference type, Microsoft overloaded some of these operators to make it easier for us to design, making it apply as if it were a value type.
At this point, I believe you have a deeper understanding of the "C# basic data type classification". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!