Data character type in C #:
String cannot be stored in the stack, obviously belongs to the reference type; CHAR is clearly worthy of value type.
String Type:
Declare a string type, not create a string object in the stack, but only a string reference is created in the stack, and there is no reference object.
A string that does not contain any character, called an empty string.
CHAR (Character) Type:
Store the text in the form of several characters in the CHAR variable, and it is stored as a 16-bit value form between 0 to 65535, represents a Unicode character.
Side character:
/' apostrophe
/" Double quotes
// slash
/ 0 null value
/ a alarm
/ B back
/ f change page
/ N wrap
/ r Enter
/ T Table Character
/ v vertical list
Tip: If the prefix of the string is @, then the subsequent string will be explained in accordance with its actual display, there is no exemplary character.
Another purpose of the escape character: CHAR C = "/ vuxxx", can give C assigning a keyboard or not a regular character.
Boolean type:
Only two values: True or False
The C # is not allowed to represent the variable of the Boolean type to any value that is not TRUE or FALSE.
Object type:
In C #, the Object type is a common type, which can represent any data type, so the type of base type, the system.object, which only determines its value in operation, and another representation is: Object.
Processing date data:
DateTime Date;
But can't assign this: Date = "10/02/1998";
It should be: date = convert.todatetime ("10/02/1998");
The value is not stored in the form of characters, but it cannot be assigned a value to be assigned, only a value of the date format can be assigned.
If you want to display on the web page, you must convert the date to a string form: strIMG DateTime = Date.toString ();
Fourth, operator
1, assignment operation:
2, arithmetic operation:
/ Division
% Try / Remain
3, the priority of the operator:
Weaken from top to bottom:
, -, one yuan -
*, /,%
,
=, =, - , * =
V. Connect strings:
And = application.
Sixth, the conversion between data types
1, implicit conversion
2, display conversion (forced conversion)
INT NUM1 = 66;
INT NUM2 = 35;
Double xxx;
XXX = NUM1 / NUM2; // There is data loss;
XXX = (double) NUM1 / NUM2; / / correct execution, equivalent to xxx = (double) NUM1 / (Double) Num2;
The priority of the mandatory type conversion is second only to the priority of parentheses, so the previous execution is not the same as XXX = (Num1 / Num2);
You cannot convert between the values and BOOL.
3, invalid mandatory type conversion
In order to avoid this, we use this technology:
Long Intnumber = 250000000;
INT xxxx;
Checked
{
XXXX = (int) intNumber;
}
4, data conversion