C # ----- vs create a simple C # program

1, vs create a simple C # program

Open File --- New Project

 

 

2. Select the visual C # following windows,  

       Then select Console Application in Windows

Name is the name of the file, the location is saved in the file location

 

 

 After clicking OK you can see a simple structure, 

       There is a class file created by default, there is a main function

The same class java class name and file name, but is running on jre, there is no namespace

 

 

 Output to print a word of it, If we do not enter this syntax will be fleeting

 

 Little is understood variables, input and output

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("HelloWrod");
            //由于会一闪而过,所以在加一个输入

            string name;
            Console.WriteLine("请输出你的名字:");
            name = Console.ReadLine();
            Console.WriteLine(name);


            //输入
            System.Console.ReadLine();
            //输出
            System.Console.WriteLine();


            // line 是一个占位符   Write就不会换行

            //变量
            string name1, name2;
            name1 = "111";

            // 将输入的数据进行复制
            name2 = System.Console.ReadLine();

            //格式化输出   "{0}{1}"   打印出的数据的顺序,从0开始
            System.Console.WriteLine("{0}{1}", name1, name2);


        }
    }
}

Guess you like

Origin www.cnblogs.com/obge/p/12169344.html