よくあるhello, world

はじめに私の使っているのはVisual Studio2005です。簡単に終わるのですがVisual Studioでせっかくテンプレートがあるのでそれを利用します。
メニューにあるファイル(F) -> 新規作成(N) -> プロジェクト(P)とすすみ、言語をC#、テンプレートをコンソールアプリケーションを選んでOKボタンを押します。

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}

すると、プロジェクトが自動で作成され拡張子がcsのファイルに上記コードも入力されています。
あとは、hello, worldと表示させるためにコードを追加するだけです。

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("hello, world");
        }
    }
}

出来上がりです。

トップページ