Code snippet plugin - c#

Are there any good code snippet plugins for visual studio? I want a plugin which can use a online snippet site (such as snipplr). It should be easy to both find and upload snippets.

You might consider snip2code plugin for VS2010.
It's interesting, I got it online...
Allows to search for your own snippets and public as well. Quick collector of code.

yes CodeKeep

There is http://www.int64.io.
It allows you to store snippets online. You can organize your snippets into "boards", give them tags, search (in near future), etc. It doesn't have a Visual Studio plugin yet, but it's coming.
Disclaimer: I'm the owner of http://www.int64.io

You might consider http://code.google.com/p/cr-codetweet/

Related

C# view source code of a particular .NET class

I browsed through some questions and this one stood out as the better one:
.Net Classes and their source code which pointed me to this place here: Microsoft Reference Source Server.
I tried everything the site says, downloaded a file that I cannot open from there and at some point ended up with a .pdb file in my source folder for the symbol cache that I could not open with a multitude of tools I looked into.
So this is my last resort to find an answer to my question. Out of pure curiosity (and lack of a better way to understand some stuff) I want to open a particular class from Microsoft (namely I wanna look into RichTextBox and maybe the classes it inherits from) but I simply cannot find a way to make this work for me. I want the original source, not a decompiler product because, well because I mainly need to understand some stuff, not see random variable names. I appreciate any help that may get me around my stupidity and clumsiness, as well as the right tools to do so (if any other than VS).
Note that I am using Visual Studio 2012 and yes, I went over a guide covering this specific version instead of the guide on VS 2008.
The "download" links on this page: http://referencesource.microsoft.com/netframework.aspx should work. However try downloading them via Internet Explorer; my Firefox attempted to download an .aspx file instead of the installer itself for some reason. (EDIT: as #ParagMeshram pointed out, just rename the netframework.aspx to netframework.msi as a quick fix if necessary)
In addition, here's a link to the source hosted by dotnetframework.org: http://www.dotnetframework.org/default.aspx/4#0/4#0/untmp/DEVDIV_TFS/Dev10/Releases/RTMRel/wpf/src/Framework/System/Windows/Controls/RichTextBox#cs/1305600/RichTextBox#cs
I can't say for certain if it's the latest greatest, or what you would be compiling against exactly, but should give you a good idea of how it works.

C# developer starting SICP - Suggested Dev Environment?

I've finally started reading SICP.
I downloaded GNU/MIT Scheme it appears that I need to work in the Edwin editor which I'm sure is great when you get used to it, however I'd really prefer not to have to learn a new editor while also learning Scheme.
I was hoping there would be a Visual Studio pluggin or something similar.
I'd actual be happy just using notepad++ and just compiling using the command line.
Has anyone got any suggestions?
Take a look at this question (a bit out of date, DrScheme is now called DrRacket).
I also see this page, which looks reasonable.
This page asks about DrRacket directly.
Edwin is pretty much the same as emacs, and that's worth learning. Any text editor will do. If you're really looking for the gui look and feel, try DrRacket? http://www.racket-lang.org/
If you are writing in mit-scheme, and are familiar with Emacs there is xscheme for Emacs
Neil Van Dyke also has a page where he has the book in texinfo format for emacs users.
sicp texinfo
You also can find videos of lectures for the book from the 80s on youtube or going to the MIT ocw site.
video lectures

Is there an interactive shell for programming quick C# code snippets?

Is there an interactive shell for programming quick code snippets in C#/.NET? Sometimes I'm interested in trying out a quick block of .NET code without creating a whole console application (that I then have to delete when I'm done).
I understand that the Immediate Window sort of provides this functionality, but it seems like you have to have an application open and be debugging it for the Immediate Window to be of any use.
I was tinkering with Ruby a while back, and the Interactive Ruby Shell (irb) was an invaluable little tool for trying out little snippets of Ruby code. Lightweight and instantaneous. This kind of thing seems like a no-brainer to me. Does anything like it exist for C#/.NET?
LINQPad is very neat for that:
LINQPad is more than a LINQ tool: it's an ergonomic C#/VB/F#
scratchpad that instantly executes any expression, statement block or
program with rich output formatting – the ultimate in dynamic
development. Put an end to those hundreds of Visual Studio Console
projects cluttering your source folder!
There isn't a full interactive shell for C#. However, for many things, you can use LINQPad to quickly try out a snippet of C# code. While it's intended for LINQ testing, it works for other C# code as well.
For details, see LINQPad as a Code Snippet IDE.
The Mono project has an interactive shell.
Also, you can use the Snippet Compiler.
There was one published by the Mono Project a while back.
Yes, there's one for mono mono-project.com/CsharpRepl
I know this is an old post, but I am new to C#. I actually found a dotnet tool that is pretty much like Java's jshell. To install simply go to powershell and enter:
dotnet tool install dotnet-repl --global
dotnet-repl.exe
Screen Shot of dotnet-repl
We've just released a small REPL tool for C# with code completion and everything called CShell.
http://cshell.net
You can also write scrips and then send them to the REPL or just write your snippets right in the REPL.
It's still in beta, but it works pretty well!
.Net Fiddle https://dotnetfiddle.net/ is an option. Not exactly an interactive environment where you can try out any expression. In .Net Fiddle, you can change the project type, compiler version, etc.
LINQPad is very good, but if you are into a quick (no installation) C# snippet testing without external dependencies (files, databases etc.) you can also use Rextester.
However, notice that its compiler version is 4.0.30319.17929, so fancy things from C# 6.0 like interpolated strings, null conditional, property initializers will not be available.
It is called snippetcompiler, will search for the url...

format ugly c# source code

I found a C# game http://www.codeproject.com/KB/game/BattleField.aspx that does what I need to learn. The source code is poorly formatted and hard to follow. I used Visual Studio's format document, but the format is still bad. How do I reformat the source code to make it easer to read?
Visual Studio's format document should help.
That being said, if you want more elaborate reformatting, you'll need a third party tool. Resharper, for example, has the option of reformatting the code, but also of doing code cleanups (where small refactorings are done on the fly to make the code itself nicer).
They provide a temporary free trial - you can see if it works for your case and this project.
That codes requires refactoring and commenting. Visual Studio can help, but this work is not fully-automated as you understand :)

Which (third-party) debug visualizers for Visual Studio 2005/2008 do you use?

I guess this topic is often overseen, but is rather useful when debugging your code. Just today I have stumbled across this simple yet effective visualizer that visualizes images (it's on a german blog, but I guess the code content is self-explanatory):
link text
I would like to know which debug visualizers you use in your daily work with VS2005/2008.
I use Mole.
Mole was designed to not only allow
the developer to view objects or data,
but to also allow the developer to
drill into properties of those objects
and then edit them. Mole allows
unlimited drilling into objects and
sub-objects.
Also check out Xml Visualizer v.2 (http://codeplex.com/XmlVisualizer)
There was a sample on an MSDN blog for the Microsoft.Xna.Framework.Matrix, I think it was. I later made my own, but it was still good.
Since I do a lot with Graphics and GDI, I found the Graphic Debug Visualizer invaluable. The Bitmap Visualizer it is based on is good too, however I had to recompile it for Visual Studio 2008 (and change the references to the various VisualStudio extension dll's).

Categories

Resources