3变量和表达式
 3.3变量
float 要写成1.5f/1.5F
数字分隔符public const double PI=3.141_592_653
 3.4表达式
输出:Console.WriteLine()
输入:Console.ReadLine()
转换Convert.ToDouble()
 4流程控制
 条件
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 
 | if(){}else{}
 
 switch(){
 case xxx:
 www;
 break;
 case......
 }
 `
 
 | 
 循环
do,while,for(同c)
 更多变量内容
 类型转换
| 12
 3
 
 | byte y;short x=287;
 y=(byte)x;
 
 | 
 复杂的变量类型
enum,struct
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 
 | enum test1 : int{
 a=1,
 b=2,
 }
 struct test2
 {
 public int a ;
 public double b;
 }
 
 | 
数组
| 12
 3
 4
 5
 
 | int[] test=new int[3];int[] test={1,2,3};
 
 const int x=3;
 int[] test=new int[x];
 
 | 
foreach循环
| 12
 3
 4
 5
 
 | int[] xs = { 1, 2 };foreach (int x in xs)
 {
 Console.WriteLine(x);
 }
 
 | 
多维数组(可用foreach)
| 12
 3
 
 | int[,] x=new int[3,4];or
 int[,] x={{1,2},{3,4}};
 
 | 
数组的数组(复杂,多层foreach)
| 1
 | int[][] x=new int [1][]{new int[]{1}}
 | 
| 12
 
 | string x="qwe";char[] y=x.ToCharArray();
 
 | 
 函数
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 
 | class Program{
 static int MaxValue(int[] x)
 {
 int maxV = x[0];
 for(int i = 1; i < x.Length; i++)
 {
 if (x[i] > maxV)
 {
 maxV = x[i];
 }
 }
 return maxV;
 }
 static void Main(string[] args)
 {
 int[] xs = { 1, 2 };
 Console.WriteLine(MaxValue(xs));
 
 }
 }
 
 or
 
 class Program
 {
 static int MaxValue(params int[] x)
 {
 int maxV = x[0];
 for(int i = 1; i < x.Length; i++)
 {
 if (x[i] > maxV)
 {
 maxV = x[i];
 }
 }
 return maxV;
 }
 static void Main(string[] args)
 {
 Console.WriteLine(MaxValue(1,2,4));
 
 }
 }
 
 | 
ref,out关键词