The learning of the basic part of language
Four elements of a function:
- Name
- Input statement
- Output statement
- Processing
Static void Main (string[]arges)//
Main function contents
Console.readkey ();//Input statement
Console.. ReadLine; Input statement
Console.WriteLine; Output Statement Wrap Line
Console.Write; Output statement, not wrap line
Namespace console.application Namespace
Class Praogram Classes
Static void Main (String[]args) method
The same number in a row is separated by commas with multiple variables
int A, B, (l name variable type, separated by commas)
integer int Int3
Float Type: float
Boolean-type bool
String Type: String
Class Type:
The final base class for all types of Object
Interface interface Type
Data type. variable name [= value]
Keyword before the variable name. Only assignments cannot be evaluated
Const int A=1
Basic Type Conversions
1. Automatic conversions from value types to reference types
2. Casts a reference class to a value class, or a floating-point conversion to an integral type, when a reference type is converted to a value type, you must reference the type element in the data, and you must convert the capacity data in the value type
- With ()
Example: int a;double b=12.3;a= (int) b;
- with convert;
Int a float C double b=12.3
A=convert. Toint32 (b);
C=convert.toisingle. (b);
With the parse;
Int A; Double b=12.3
A=int.parse (b);
4.26 Basic Language Learning