C #
Chapter 3:
3.1 C #
1. No matter whether the Code contains spaces, carriage returns, or
3.2
1. Yes. Different types of data must be processed in different ways. Variables are limited to different types to avoid confusion between them. For example
2.
3.2.1
1. A simple type is the type of basic components in an application, such as numeric values and boolean values.
2. Simple types are different from complex types, and there cannot be child types or attributes.
3. The reason why there are too many numeric types is that numbers are used as a series
4. Value Type table:
Integer:
Type |
Alias |
Allowed value |
Sbyte |
System. SByte |
In |
Byte |
System. Byte |
In |
Short |
System. Int16 |
In |
Ushort |
System. UInt16 |
In |
Int |
System. Int32 |
In |
Uint |
System. UInt32 |
In |
Long |
System. Int64 |
In |
Ulong |
System. UInt64 |
In |
Floating point:
Type |
Alias |
Float |
System. Single |
Double |
System. Double |
Decimal |
System. Decimal |
Character:
Type |
Alias |
Allowed value |
Bool |
System. Boolean |
True/flase |
Char |
System. Char |
One |
String |
System. String |
A group of characters |
Note:
1.
2. string
3.3.2
The basic naming rules are as follows:
1. the first character of the variable name must be a letter, underscore, or
2. The subsequent characters can be letters, underscores, or numbers.
Microsoft
For simple variables, use
3.3.3
Escape Sequence
Escape Sequence |
Generated characters |
Character |
\' |
Single quotes |
Zero x 0027 |
\" |
Double quotation marks |
Zero x 0022 |
\\ |
Backslash |
0x005C |
\ 0 |
Null |
Zero x 0000 |
\ |
Warning (generate beep) |
Zero x 0007 |
\ B |
Return |
Zero x 0008 |
\ F |
Form feed |
0x000C |
\ N |
Line feed |
0x000A |
\ R |
Enter |
0x000D |
\ T |
Horizontal Tab |
Zero x 0009 |
\ V |
Vertical Tab |
0x000B |
Notice
Unicode
For example, "wyh \'s blog" is equivalent to "wyh \ u0027s blog"
3.3.4
1. Declare multiple variables of the same type at the same time.
Int xsize, ysize;
3.4
1.
3.4.1
1. + var1 =-var2; // var1 = var2 *-1
Var1 = + nar2;
+
2. Pair
3. Char
4. String
5. Increment and decrease operators:
Operator |
Category |
Example |
Result |
++ |
|
Var1 = ++ var2 |
Var1 |
-- |
|
Var1 = -- var2 |
|
++ |
|
Var1 = var2 ++ |
|
-- |
|
Var1 = var2 -- |
|
1. ++
2 .--
3.4.2
=
3.4.3
Priority |
Operator |
High |
++ |
* |
+ |
To |
= |
Low |
++ |
3.4.4
1. The name is uniquely defined by the namespace.
Namespace levelone
{
// Name "namethree" defined
Namespace leveltwo
{
// Name "namethree" defined
}
}
2. using
Namespace levelone
{
Using levelone;
Namespace leveltwo
{
// Name "namewo" defined
}
}
Levelone