Keep Your C# Clean with Tidy C# Extension

Sign in to queue

Description

Batch styling? Right-click clean up? Quick code format fixing?

That's what what I have in my mind about today's extension.

Pick a C# File, right-click and select "Clean up" and Run. And then check out your now cleaned up and formatted code.

That's today's extension!

Tidy C#

A Visual Studio extension that adds a few enhancements to improve C# code development. It provides a list of automatic refactoring tools for cleaner C# code.

  1. Close all open windows
  2. Right click on a C# file, folder, project or even the whole solution.
  3. Select "Clean up C#..."
  4. In the pop-up select the clean up actions you are interested in.
  5. Click Run

image

It will then open each file, apply the clean up actions, save and close. It can take a few minutes for a large codebase.

Recommendation

Check out all of its changes in your source control tool diff tool.

[Click through to download it]

It's open source too (and under active development... ;)

image



The Discussion

  • User profile image
    Darren_Evans

    Another great tool is Code Maid

  • User profile image
    gduncan411
  • User profile image
    Dev

    Useless tool that employ bad coding practices and can cause damage to good, clean and neat code: removing brackets from one liners? Bad and bug prone. Removing private keywords? Useless and bad, the code is cleaner and clearier with emplicit programming instead of implicit. Var for variable declarations? I hate vars! State your purpose that's the whole point of strongly typed language. Bug prone and hides intent.

  • User profile image
    Nick

    dotnet/corefx Coding Style
    - We always specify the visibility, even if it's the default

  • User profile image
    dandy

    @Dev:  Seems to me this is exactly why every option has a checkbox.

  • User profile image
    Dev

    Dandy, having the ability to enable bad code practices is prone to misuse and misunderstanding by noob developers, those checkboxes should never be marked.

    If you had the ability to reverse those options, like adding privates keywords and brackets for oneliners for example, I'd agree.

    But reading what I wrote earlier, I did sound like a big douche (I had a rough morning), so appologies all around.

  • User profile image
    wkempf

    @Dev Some of what you said I can agree with, and some absolutely not. You want a strongly typed language? Try Haskell. Oh, BTW, Haskell relies heavily on type inference (your hated var). Can you write bad code with it? Yes, but that's true of every API, operator, keyword and feature.

    You obviously have a strong idea of what "good maintainable code" looks like. Doesn't it make sense to use tools to enforce that, and make it easier? You hate var. Wouldn't you want something to ensure your team doesn't use it then?

Add Your 2 Cents