4

Is there an online C# beautifier that is easy to paste-beautify-copy from?

I am looking for one that has options for:

  • Indentation (4 spaces, n spaces, tab char, etc)
  • Curly braces placement (on the statement line, on own line)

Much like Jsbeautier, but for C#.

  • Any particular reason you want it to be online rather than a program on your computer? – Nick Wilde Mar 23 '14 at 22:44
  • @NickWilde because the code I mostly beautify is copypasted from SO posts which have pieces of code that do not compile or are errenous by themselves, so that is out of the question. – user1306322 Mar 23 '14 at 23:01
  • I would expect that there are some plugins that could do that without compiling but I see what you mean – Nick Wilde Mar 23 '14 at 23:13
  • 1
    Oh, wait, you mean why not offline if there could be such a program. No reason why not, really, but online could be much more accessible and not require additional installation, which is nice if my notebook isn't with me. – user1306322 Mar 23 '14 at 23:15
1

C# Viewer

It does not really have any of the extra options that you want. However it does very nicely beautify - and also minify - C# code.

It also lets you one click download the code as a *.cs file and load C# code to process from a file or web location as well as Copy/Paste.

  • This is nice and it has some auto-formatted editing capabilities, but editing the beautified code messes up the space characters and it doesn't have options for curly braces or any other options at that. – user1306322 Mar 23 '14 at 23:20
  • Yeah that's what I saw but I'm not aware of any other options (I used it fair while ago for some SO code myself but since I rarely use C# I haven't had much inclination to search for something better. – Nick Wilde Mar 23 '14 at 23:23
1

Although it has to be installed a better solution is to use SublimeAStyleFormatter - which is a Sublime Text Plugin.

You have to first install Sublime Text (painless) and then install SublimeAStyleFormatter which is also quite painless. There are a couple methods you can use to install it (all of which are detailed in the readme) but I recommend the Package Control method as very easy.

There are quite a few options:

1

C# Formatter Online

Pros:

  • Correct beautify.
  • Online.
  • Input C# code and copy/paste c# beautified code.
  • Download .cs beautified version.

Cons:

  • Only two options for formatting fonts: small and big.
  • K&R bracing, which is not usual C# formatting.
-3

I would use the online c# formatter http://codebeautify.org/csharpviewer where I can formate as well as share my code as public or private.

  • 1
    That answer was already given – user416 May 7 '15 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.