メインコンテンツへスキップ
Z

C#フォーマッター

Reindent only — not a full formatter

C#のソースコードをAllman形式の波括弧で再インデントし、自動プロパティを正規化して式形式メンバーを整えます。あくまでインデント整形ツールであり、Roslynによる完全なフォーマッターではありません。

無料 登録不要 クライアントサイド プライバシーに配慮 Updated

使い方

  1. 1 C#のソースコードを貼り付けます。
  2. 2 波括弧のスタイル(C#の既定はAllman形式)とインデント幅を選びます。
  3. 3 自動プロパティの正規化をオンにすると、<code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">{get;set;}</code> のような記述が整います。
  4. 4 結果をコピーするか、ファイルとしてダウンロードします。

このツールを使う理由

  • 既定設定はMicrosoft / Visual Studioのスタイル(Allman形式の波括弧、4スペースインデント)に合わせています。
  • 自動プロパティや式形式メンバーといった、よく使われる省略記法を整えます。
  • 処理はすべてクライアント側で完結するため、コードがブラウザの外に送信されることはありません。
  • Roslyn準拠の厳密なフォーマットが必要な場合は、ローカルで<code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">dotnet format</code>を使ってください。

よくある質問

このツールはdotnet format CLIと同じ結果になりますか?

波括弧やインデントについてはかなり近い結果になりますが、CLI版のdotnet formatはusingの並べ替えやアナライザーの適用、式の書き換えまで行います。厳密な結果が必要な場合はdotnet formatを使用してください。

LINQのメソッドチェーンには手を加えますか?

複数行に分かれているLINQ文はインデントを再調整しますが、内容が書き換えられることはありません。メソッドチェーンの改行構成はそのまま保持されます。

Java用のフォーマッターを探していますか?

ご用意しています。同じエンジンを使い、既定でK&R形式を採用した<a href="/java-formatter" class="underline">Javaフォーマッター</a>をご覧ください。

C#フォーマッター とは?

C#フォーマッターは、C#のソースコードをブラウザ上でAllman形式の波括弧に再インデントし、あわせて自動プロパティの正規化や式形式メンバーの整形も行うツールです。Roslynベースの完全なフォーマッターではなくインデント整形ツールとして動作し、コードの見た目を一貫させながらも、ソースコードは常にユーザーの手元(デバイス側)に留まります。

機能

Allman-style reindent

Re-indents by nesting and places braces on their own line, the .NET convention (K&R also available).

Accessor & => tidy

Normalizes `{ get; set; }` spacing and expression-bodied member arrows.

100% private

Runs client-side — your C# is never uploaded.

Input

public class A {
int X{get;set;}
}

Output

public class A
{
    int X{ get; set; }
}

主な用途

  1. 1

    Fix pasted C#

    Repair indentation on a snippet from a log, gist, or forum.

  2. 2

    Apply Allman style

    Normalize brace placement to the standard .NET convention.

  3. 3

    Tidy before commit

    Clean up layout without running a full dotnet-format pass.

概要

Zerethon's C# formatter reindents C# source in your browser by brace depth, defaulting to the Allman brace style common in .NET, and normalizes auto-property accessors (`{ get; set; }`) and expression-bodied `=>` spacing. It is a lightweight reindenter, not a full dotnet-format — it tidies layout without a full rewrite. Nothing is uploaded.

カテゴリ
開発者
料金
無料
プライバシー
ブラウザベース
登録
不要

References

プライバシー

明記されない限り、データがブラウザの外に送信されることはありません。C#フォーマッター は完全にクライアント側で動作します — サーバーへのアップロードなし、ログなし、入力内容のトラッキングなし。

関連ツール

Zerethon Social で作成・共有・成長しよう

無料登録。ポイントを獲得し、実績を集め、世界中のクリエイターとつながりましょう。

無料登録