zoukankan      html  css  js  c++  java
  • (原创)c#学习笔记02--编写c#程序02--控制台应用程序

    2.2  控制台应用程序

      在本解说中,将创建一个简单的控制台应用程序。创建方法参考:(原创)c#学习笔记02--编写c#程序01--开发环境

      创建成功后,在主窗口显示的文件里添加如下代码行:

    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)
            {
                // Output text to the screen.
                Console.WriteLine( "The first app in Beginning c# Programming!" );
                Console.ReadKey(); 
            }
        }
    }

      选择 “调试➪启动调试” (Debug➪Start Debugging)菜单项,运行结果如下图所示:

      按下任意键,退出应用程序(首先需要单击控制台窗口,以激活它)。

      控制台应用程序会在执行完毕后立即终止,如果直接通过IDE运行它们,就无法看到运行的结果。为了解决上例中的这个问题,使用 

    Console.ReadKey(); 

    告诉代码在结束前等待按键。

  • 相关阅读:
    第一阶段各队建议
    解决死锁四大方式
    进程和线程区别
    windows 地址空间分配
    Linux下用户组、文件权限详解
    2016总结
    class内部处理
    c++ devived object model
    static
    reinterpret
  • 原文地址:https://www.cnblogs.com/wodehao0808/p/4885359.html
Copyright © 2011-2022 走看看