Input C# Code
4 Spaces Indent
Tab Indent
2 Spaces Indent
4 Spaces Indent
8 Spaces Indent
1
Processing Result
1

Instructions & C# Knowledge

How to use this tool

  • Auto Response: Paste or modify the code in the left input box, and the system will automatically format it for you 500ms after you stop typing.
  • C# Format: Supports standard C# code layout, and intelligently provides safe protection and syntax highlighting for features like auto-properties ({ get; set; }), interpolated strings ($""), verbatim strings (@""), and attributes ([Route(...)]).
  • Save Locally: Click the "Save Locally" button on the right to directly download the formatted code as a .cs source file.

C# Code Specifications & Features

  • Namespaces & Classes: C# uses namespace to organize code. It is generally recommended to use PascalCase for naming classes and methods, and camelCase for local variables and method parameters.
  • Brace Style: Although the official Microsoft C# specification recommends the Allman style (braces on their own line), this tool defaults to the K&R style (left brace on the same line as the statement) for a more compact reading experience on the web.
  • Auto-Properties: In C#, the shorthand form of properties { get; set; } is very common. This tool automatically identifies them during formatting and ensures they are arranged compactly on the same line to improve code neatness.