C# basic knowledge compilation: basic knowledge (1) Main method

黄舟
Release: 2017-02-10 15:29:54
Original
1545 people have browsed it

A journey of a thousand miles begins with a single step. To master a certain skill, you must start with the most basic things. Review the past and learn the new. When you do a small thing in different situations and at different times, you can always get unexpected experiences and gains.
Then let’s start with the Main method first,

//using关键字在该处的作用是引入一个“外部程序集”,System是微软提供的.net平台最基本程序集,所有.net程序都必须引用该程序集。
using System;
//命名空间,允许一个类属于一个命名空间,也可以多个类同在一个命名空间;
//作用是,防止类名冲突,也就是说,不同的命名空间里可以有类名相同的类;当然在规范的代码里,命名空间可以组织类的层次,
//比如:公司名.项目名.模块名... 这样的层次,工程的层次一目了然。
namespace YYS.CSharpStudy.MainConsole
{
    //C#是纯面向对象的语言,类是所有代码的基础,class关键字可以定义一个类。
    class Program
    {
        //Main方法是项目启动的入口,程序从Main开始运行的。string[] args是控制台参数,由程序运行着从控制台传入。
        //标准写法如下。
        /// <summary>
        /// Main方法
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Console.WriteLine("Hello,World!");

            Console.ReadKey();
        }
    }
}
Copy after login

Seeing this familiar Hello, World, can it bring back those years, those people, those World of Warcraft, those teachers, those computers... . ..Where are those good memories?

The above is the summary of C# basic knowledge: Basic knowledge (1) Main method. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!