编辑代码

using System;
//值类型
/*
public class Exa_1
{       public struct Point { public int X; public int Y; }
        static void Main()
        {
          Point p1 = new Point();
          p1.X = 7;

          Point p2 = p1;                // Assignment causes copy

          Console.WriteLine (p1.X);  // 7
          Console.WriteLine (p2.X);  // 7

          p1.X = 9;                     // Change p1.X

          Console.WriteLine (p1.X);  // 9
          Console.WriteLine (p2.X);  // 7
        }
}
*/
//引用类型
/*public class Exa01
{   public class Point { public int X, Y; }
        static void Main()
        {
          Point p1 = new Point();
          p1.X = 7;

          Point p2 = p1;                // Copies p1 reference

          Console.WriteLine (p1.X);  // 7
          Console.WriteLine (p2.X);  // 7

          p1.X = 9;                     // Change p1.X

          Console.WriteLine (p1.X);  // 9
          Console.WriteLine (p2.X);  // 9
        }
}*/

//原意字符串
/*
public class HelloWorld
{
    public static void Main()
    {
        string escaped  = "First Line\r\nSecond Line";
        string verbatim = @"First LineSecond Line";

        
         Console.WriteLine (escaped == verbatim);

    }
}*/
//字符串插值
/*
public class HelloWorld
{
    public static void Main()
    {
       int x=4;
       Console.Write($"A square has {x} sides");
       string s=$@"this apansP{x} lines";
       Console.Write(s);

    }
}*/
//值类型和引用类型元素初始化
/*
public class HelloWorld
{
    public struct Point { public int X, Y; }
    public static void Main()
    {
        Point[] a = new Point[1000];
        int x = a[500].X; 
    }
}*/
/*
public class HelloWorld
{
    public class Point { public int X, Y; }
    public static void Main()
    {
        Point[] a = new Point[1000];
        int x = a[500].X; 
    }
}*/
//矩形数组
/*
public class HelloWorld
{
    public static void Main()
    {
        int[, ] matrix = new int[3,3];
        for (int i = 0; i < matrix.GetLength(0); i++)
          for (int j = 0; j < matrix.GetLength(1); j++){
            matrix[i, j] = i * 3 + j;
            Console.Write(matrix[i, j]);
          }
         int[, ] matrix1 = new int[, ]
        {
          {0,1,2},
          {3,4,5},
          {6,7,8}
        };
        for (int i = 0; i < matrix1.GetLength(0); i++)
          for (int j = 0; j < matrix1.GetLength(1); j++)
            Console.Write(matrix1[i, j]);
    }
}*/
//锯齿形数组
/*
public class HelloWorld
{
    public static void Main()
    {
        int[][] matrix = new int[3][];
        for (int i = 0; i < matrix.Length; i++)
        {
          matrix[i] = new int[3];                        // Create inner array
          for (int j = 0; j < matrix[i].Length; j++){
            matrix[i][j] = i * 3 + j;
          }    
        }
        int[][] matrix1 = new int[][]
        {
          new int[] {0,1,2},
          new int[] {3,4,5},
          new int[] {6,7,8,9}
        };
    }
}*/
//传值
/*
class Test
        {
          static void Foo (int p)
          {
            p = p + 1;                   // Increment p by 1
            Console.WriteLine (p);       // Write p to screen
          }

          static void Main()
          {
            int x = 8;
            Foo (x);                     // Make a copy of x
            Console.WriteLine (x);       // x will still be 8
          }
        }
*/
//传引用
using System.Text;
/*
        class Test
        {
          static void Foo (StringBuilder fooSB)
          {
            fooSB.Append ("test");
            fooSB = null;
          }

          static void Main()
          {
            StringBuilder sb = new StringBuilder();
            Foo (sb);
            Console.WriteLine (sb.ToString());     // test
          }
        }
*/
//输出
//ref
/*  class Test
         {
           static void Swap (ref string a, ref string b)
           {
             string temp = a;
             a = b;
             b = temp;
           }
           static void Main()
           {
             string x = "Penn";
             string y = "Teller";
             Swap (ref x, ref y);
             Console.WriteLine (x);    // Teller
             Console.WriteLine (y);    // Penn
           }
         }
*/
//out
/*
        class Test
        {
          static void Split (string name, out string firstNames,
                              out string lastName)
          {
              int i = name.LastIndexOf (' ');
              firstNames = name.Substring (0, i);
              lastName    = name.Substring (i + 1);
          }

          static void Main()
          {
            string a, b;
            Split ("Stevie Ray Vaughan", out a, out b);
            Console.WriteLine (a);                          // Stevie Ray
            Console.WriteLine (b);                          // Vaughan
          }
        }*/
//可变参数
/*
        class Test
        {
          static int Sum (params int[] ints)
          {
            int sum = 0;
            for (int i = 0; i < ints.Length; i++)
              sum += ints[i];                           // Increase sum by ints[i]
            return sum;
          }

          static void Main()
          {
            int total = Sum (1, 2, 3, 4);
            Console.WriteLine (total);                 // 10
          }
        }*/
//null运算符
/*
public class HelloWorld
{
    public static void Main()
    {
        string s1 = null;
        string s2 = s1??"nothing";    // s2 evaluates to "nothing"
        Console.Write(s2);
        System.Text.StringBuilder sb = null;
        string s = sb?.ToString();  // No error; s instead evaluates to null
        Console.Write(s);
    }
}*/
//命名空间
using  System.Security.Cryptography;
class Test{
    static void Main(){
        System.Security.Cryptography.RSA rsa =
        System.Security.Cryptography.RSA.Create();
    }
            
}

namespace Outer.Middle.Inner
        {
          class Class1 {}
          class Class2 {}
        }
/*using Outer.Middle.Inner;
        class Test
        {
          static void Main()
          {
            Class1 c;     // Don't need fully qualified name
          }
        }
    */