A string cannot be stored on the stack, obviously a reference type, and char is obviously a value type.
String type:
When declaring a string type, instead of creating a string object in the heap, a reference to a string is created in the stack and no reference to a string object has been made.
A string that does not contain any characters, called an empty string.
char (character) type:
Stores text as a number, placing a single character in a variable of char, and it is stored as a 16-bit numeric form between 0~65535, representing a Unicode character.
Escape character:
\ ' Single quotes
\ "Double Quotes
\ Slash Slash
Null value
\a Alarm
\b Backspace
\f Page Change
\ n Line Change
\ r Carriage Return
\ t tab-stop characters
\v Vertical List character
Tip: If the prefix of the string is @, then the string will be interpreted according to the meaning of its actual display, and there is no escape character, Fu Zhi said.
Another use of the escape character: Char c= "\vuxxxx" to give C a character that is not on the keyboard or is not normal.
Boolean type:
Only two values: TRUE or False
A variable of a Boolean type is not allowed in C # to represent any value that is not true or false.
Object type:
In C #, an object type is a generic type that can represent any data type, and is the base type of the type, that is, System.Object, which can only be determined at run value, and another representation is: object.
Process Date Data:
DateTime date;
But not this assignment: date= "10/02/1998";
should be: Date=convert.todatetime ("10/02/1998");
The value is not stored as a character but as a numeric situation, but it cannot be assigned an integer value and can only be assigned a date-formatted value.
If you want the page to be displayed, you must convert the date to a string form: Strimg datetime=date. ToString ();
Four, operator
1. Assignment Operation:
2. Arithmetic operation:
/Division
% modulo/remainder
3, the precedence of operators:
Decrease in descending order from top to bottom:
++,--, one dollar-
*,/,%
+,-
=,+=,-+,*=
V. Connection string:
+ and + + applications.
Vi. conversions between data types
1. Implicit conversion
2. Display conversion (CAST)
int num1=66;
int num2=35;
Double xxx;
xxx=num1/num2; Data loss exists;
xxx= (double) num1/num2; The correct execution is equivalent to xxx= (double) num1/(double) num2;
The priority of the coercion type conversion is second only to the parentheses, so the preceding execution is different from the value of xxx= (double) (num1/num2).
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.