Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am looking for a (preferably) command-line tool that can reformat the C# source code on a directory tree. Ideally, I should be able to customize the formatting. Bonus points if the tool can be run on Mono (or Linux).
You could also try NArrange to reformat your code. The formatting options it supports are still pretty limited, but it can process an entire directory and is a command-line tool. Also, NArrange runs under Mono.
You could give Artistic Style a try. It requires Perl to be installed though.
It's got a decent list of formatting options, and supports C and Java as well.
This isn't command-line, Mono or Linux, but it's something: I've been using ReSharper (made by JetBrains) and it's rather good. It's a Visual Studio plugin, so I'm guessing it's not your cup of tea.
Take a look at Polystyle
See our SD C# Formatter. Uses a full C# parser and prettyprinter; it will not break your code.
EDIT: September, 2013: Now runs on Windows and Linux. Covers C# v5.
I use Emacs and csharp-mode. One keystroke and the module is reformatted according to my desires.
Before:
After:
For completeness, check out http://uncrustify.sourceforge.net/
Check out astyle. I am sure the KDE guys use it, but the website said that it supports C#.
Maybe you could take a look at this free Addin for Visual Studio 2010/2012 i recently wrote :)
I am going to second the ReSharper suggestion. I can't live without it.
The built-in reformatting is under ReSharper → Tools → Cleanup Code menu and is bound to Ctrl + E, Ctrl + C by default.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I know that there is ReSharper for C# for helping to program, is there something similar for C++?
Update: The JetBrains are working on Resharper for C++.
While not quite as good for C++ as Resharper is for C#, Whole Tomato makes a product called Visual Assist X which handles C++ and does it in a reasonably performant manner.
Developer Express also makes CodeRush, which provides more features than Visual Assist, but which is also a much harder drain on your computer, and also which occasionally makes mistakes -- most constructs using macros won't work correctly with CodeRush. Note that as of 2013-05-31, CodeRush has deprecated their C++ support.
Resharper and Visual Assist are nice to have around -- I occasionally flip on CodeRush for some of it's better refactorings, but most of the time leave it off because Visual Assist X's code completion assistance is better.
Do keep in mind that installing any such plugin requires running the IDE in Integrated Mode (rather than Isolated Mode). This means:
In Visual Studio 2012 or earlier you'll need a full version of Visual Studio, not one of the express editions. If you're a university student you can probably download a full copy from MSDNAA. If you're a non-university student or your university doesn't provide MSDNAA you can still download a full version from DreamSpark.
In Visual Studio 2013 or later you can use the "Community Edition", such as Visual Studio Community 2013.
Public announcement of C++ support in ReSharper: http://blogs.jetbrains.com/dotnet/2013/06/resharper-to-support-c
Visual Assist
Once you use this program, you really can't live without it. (And when I say program, I mean add-in!)
It wholly depends on which features you were using from Resharper.
Personal experience: I've used both Resharper and Visual Assist X for at least half a year both, and in the end I went with this free package: Productivity Power Tools by Microsoft: http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/
Visual Studio 2010 has some improvements similar to what Resharper offers. It's not as good, but there's always Lint. Also, you may be interested in any number of static analysis tools.
Try, VisualAssist X from http://www.wholetomato.com/
This is a VS plugin with support right from VC6-VS2010
(for VC6 I would say, it is as good as ReSharper)
JetBrains is working on C++ support for upcoming version of ReSharper.
It is currently available in closed beta.
ReSharper for C++ is available at public EAP - http://www.jetbrains.com/resharper/features/cpp.html
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I often write consoles for various things (and I've made my own library - but it's quite limited), I do this mainly because the Windows command line sucks. Is there an open source library I can use for writing such command line applications? By console, I mean a command prompt with auto-complete (tab) and copy/paste.
Update:
Please do not recommend that I use something other than cmd.exe (e.g. PowerShell), since PowerShell may not always be available. Also, I'm looking for a library that makes my application behave like a command line interpreter; I'm not looking for a library that helps me parse command arguments.
I think I wrote pretty much exactly what you asked for :)
It's open source on github, is dead simple to use, and has a bunch of examples.
I used Command Line Parser before and it's really good for getting the command line params in a nice, configurable way. Have a look, maybe it'd do what you want.
You may find this one-file-with-demo library useful.
For tab completion/hinting, i wrote the following lib:
https://github.com/fjunqueira/hinter
It might be helpful to someone.
You may be interested in this article:
http://kamimucode.com/Home.aspx/C-sharp-REPL/1
Maybe you need to implement a REPL:
http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop
Regards,
Giacomo
You might want to use PowerShell instead of cmd.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm sure something like this exists, but I can't for the life of me remember what it is called.
I'm looking for an app where I can just execute an arbitrary block of C# code and see any console output.
http://www.sliver.com/dotnet/SnippetCompiler/
Snippet Compiler
Not necessarily a snippet compiler but I use it for that purpose also:
LINQPad
The neat thing about it is that you can dump intermediate results to the output and has very nice formatting for all types of objects so you won't have to write Console.WriteLine(...) statements.
You can also write only expressions, or simple statements or classes, and it will compile all of them.
There is also LINQ Pad. It will work as a snippet compiler and lets you run linq against sql server.
Mono has GSharp, which I personally use all the time.
http://tirania.org/blog/archive/2008/Nov-02.html
Another approach is offered by TestDriven.Net, which allows you to click on any method in the Visual Studio code editor and run it directly.
This can be useful for debugging code that's otherwise buried a little deep to conveniently access.
To round out the other answers, there's also:
Snippy (by Jon Skeet) - also check out the Reflector add-in (be sure to look for the latest version on the author's blog).
Matthew Manela's FastSharp.
LINQPad is my favorite :)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Where can I find a control for WinForms that will highlight source code pasted into it? I would like one that has syntax highlighting support for many different languages but if it only works with C# I would be fine with that also.
Scintilla.NET is probably what you're looking for
Just recently have found a nice control from codeproject Fast Colored TextBox for syntax highlighting.
The only issue with using Rich Text Box as highlighter is slow performance on coloring, in cases when the size of the document is big. For a medium size documents this issue can be fixed by delayed highlighting.
As Open Source alternatives, give a look to:
dotNetFireball
ICSharpCode.TextEditor from SharpDevelop
Add ICSharpCode.TextEditor assembly reference to a project, choose assembly and controls for Visual Studio Toolbox. After that, you can put control to the Form. Surprisingly, you will not see Property to choose syntax highlight schema. Instead of this, you have to use method SetHighlighting. String parameter sets highlighting schema from available schemas list. These schemas are embedded into the control.
How to use, change schemas and download sample, look following article
If you're willing to pay for a control, I highly recommend this one: QWhale Syntax Edit. It's got a ton of features, comes with source code, and supports a lot of languages. I use it myself for C#, VB.NET, SQL (MS & Oracle), and it's got everything that VS provides.
Not sure if there is any out of the box non-thirdparty solution to this.
But, have you looked at Actipro SyntaxEditor component. LinqPad, the ubercool linq tool uses it for syntax highlighting and intellisense.
Check out the AvalonEdit control. There is a good article on CodeProject explaining how to use it.
you can try this http://www.codeproject.com/KB/edit/SyntaxHighlighting.aspx
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I used to work with eclipse for nearly all the languages I need. I'm asked to work on a tool developed in C# and so, I would like to stay in the same familiar environment.
I've found the improve's plugin but its last release is from 2004 and .NET 1.1 which is quite old. Is there a newer plugin to program in C# within eclipse or am I forced to take a look at VS?
Emonic integrates mono into the eclipse framework, that may be of use.
I fear, that there is no good eclipse plug in. Try http://www.monodevelop.com/Main_Page or http://www.icsharpcode.net/OpenSource/SD/. And the free visual 2008 express editions are worth a look.
I have found below 2 articles helpful in trying to get C# Formatting in Eclipse:
C# Like format.xml
Article explaning how to change your formatting
MonoDevelop just released a Windows Beta, and it's looking very good. It's a cross platform C# IDE. It may be of use.
Emonic is worth a look as Jasper suggested. I've installed it in the past myself, but over a year ago. Checking the change logs on the site, it does not appear that they have had any new releases since then. The worst thing about it is that it does not supply a debugger or any refactoring tools. I've found that if you're going to work with Microsoft products it's best to eat the whole hog.
You will have a learning curve getting into visual studion from eclipse, but it will probably save you some time working out the nuiances with a product trying to build .NET code.
Visual Studio is a very nice environment to work in, the express editions are free so my suggestion would be to take the opportunity and have a look at the VS dev environment.