Skip to content

DressSharp · bespoke C# formatting

Your C#,
tailored to the line.

DressSharp cuts every line of your C# to the measurements you choose, and leaves the rest exactly as it was. Nothing off the rack, and nothing you did not ask for.

  1. 01
    Measuredotnet dress init

    Writes every rule, set to its default, into your EditorConfig. The whole fit is in one file you can read and change.

  2. 02
    Cutdotnet dress

    Formats your code to those measurements, and only those. A rule you leave unset changes nothing.

  3. 03
    Alterdotnet dress format --staged

    Hook it into your commits or your coding agent, and everything you touch arrives already pressed.

The first fitting

One run of dotnet dress with the default rules. The chalk line is max_line_length = 160.

using System.Linq;
using System;

namespace Shop.Orders {
    public class OrderTotals {
        readonly IPricing pricing; readonly ILogger log;
        public OrderTotals( IPricing pricing,ILogger log ) { this.pricing=pricing; this.log = log; }

        public decimal Total(Order order, bool includeShipping) {
            if(order.Lines.Count==0) return 0m;
            var subtotal = order.Lines.Where(line => line.Quantity > 0).Sum(line => pricing.PriceFor(line.Sku, line.Quantity, order.Customer.Tier, order.CurrencyCode));
            var shipping = includeShipping ? pricing.Shipping(order.Destination, order.Weight, order.Customer.Tier) : 0m;
            log.Info($"Order {order.Id}: {subtotal} + {shipping}");
            return subtotal+shipping;
        }
    }
}
Off the rack: 17 lines, the longest 168 columns, past the chalk line.Tailored: 28 lines, the longest 117 columns.

dotnet dress interactive

Try it on in the fitting room.

Choosing formatting rules from a list of settings is guesswork. The fitting room opens your EditorConfig in the browser, fully offline, with code in the mirror, so you see exactly what every rule does before you commit to it.

DressSharp interactive with the Wrapping rules open: parameters set to always multi, and the preview showing the parameter list re-cut one to a line.
  1. Watch every change land

    Flip a rule and the preview re-cuts on the spot, your original beside the result.

  2. Try it on your own code

    Paste in the code you actually write, not a tidy sample.

  3. Ask why a line moved

    Select any lines to see just the rules that shaped them.

  4. Save when it fits

    One click writes your choices straight into your EditorConfig.

dotnet dress interactiveHow to choose your rules →

The house rules

Unopinionated

Made to measure

Every rule is yours to choose. A rule you leave unset changes nothing, and dotnet dress init writes every rule with its default into your EditorConfig, so the whole fit is in one file you can read.

Speaks EditorConfig

Your pattern, in EditorConfig

The csharp_* and dotnet_* settings your team already uses work as they do in Visual Studio. Where they stop, DressSharp picks up: list wrapping, closing delimiters, comment alignment, blank lines, and more.

Formats as you work

Alterations while you wait

Run it on every commit, or every time your coding agent writes a file. It only touches what changed, so it stays out of your way, and formatting never comes up in code review again.

Ready for your first fitting?

dotnet tool install --global DressSharpdotnet dress initdotnet dress interactive
Get started →