C#学习--Hellow World

这里主要看一下Hello World代码

// 单行注释

/* 
 多行注释
 */

/// XML文档注释

// using 引用命名空间,类似PHP的use
using System; // .NET FrameWork应用程序根命名空间
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1 // 声明命名空间
{

    class Progra //声明一个Program类
    {
        // Main方法,所有C#程序入口,一个C#程序中有且只有一个Main方法,“Main”方法必须放在任意一个类中。对于被调用的“Main”方法来说,它所在的类不需要被实例化。
     /* *static 返回值类型 *void 返回值 *Main 方法名 *args 方法参数,为一个字符串数组 */ static void Main(string[] args) { // System命名空间Console类调用类方法WriteLine()方法,输出hello world Console.WriteLine("hello world"); // 控制台程序,执行完了就会终止,速度很快,看不到结果;所以加上这句代码,结束前等待按键 Console.ReadKey(); /* 注:* C#是大小写敏感的 * 所有语句和表达式必须以分号结尾 * 程序执行从main方法开始 * 与java不同,文件名可以不同于类的名称 */ } } }
posted @ 2016-08-27 06:25  游戏人生。  阅读(387)  评论(0编辑  收藏  举报