CATEGORY

Console Application Template

[C#][.NET] Console Application Template

※ 当サイトは広告を含みます。

C#でコンソールアプリケーションを作るときのテンプレート。
もはや自分用。置いておけば検索できて便利だと思った。

ソースコード

Mainに直接書くとstaticの制約があまりにも鬱陶しいので分割してます。


namespace ConsoleApp
{
  internal class Program
  {
    static int Main(string[] args)
    {
      return new Application().Run(args);
    }
  }
}

using System;

namespace ConsoleApp
{
  internal class Application
  {
    private const int EXIT_SUCCESS = 0;
    private const int EXIT_FAILURE = 1;

    public int Run(string[] args)
    {
      return EXIT_SUCCESS;
    }
  }
}

GitHubhttps://github.com/Takemi392/Code.20250601.1038

あとがき

管理人
管理人

インデントは2スペース派です。

この記事は参考になりましたか?

コメント

この記事へのコメントはありません。