What are some open source C# projects I can download that implement many best-practices and have a relatively high code quality?

Please accompany your answer with some of the reasons you consider the code is of high quality.

Suggestions so far:


forums.agbotting.net in the release forum go to svns, I know the guy who coded that it's a bot and maphack for a video game called Diablo II, that him and a friend wrote themselfs. I believe it's of pretty good quality, and it's not very huge.


P.S When it doubt, call the magic powers of source forge.

Oh yeah, and of course SharpDevelop

Funny to something like that mentioned. I wrote d2botnet, a .net based botting engine for D2 as well. seems someone revived the website for whatever reason. http://www.d2botnet.net/
I've heared of you before.
Matt! Long time no talk!
Jeff Hubbard
Ah, my posts are reuniting old friend's. Glorious
thanks, both of these bots look interesting.
Your welcome only one of those is a bot however, the other is a maphack.
Jeff: lord2800 iirc? If I am wrong, i apologize, i dont remember 'real' names too well :/
@Rayne, well I was referring to the bot you posted and then the bot mattlant posted. I'm still looking through the source you posted Rayne.
Oh, I thought you were refering to the links I mentioned.
@mattlant: Yep, that's me. I decided to go with my real name here.
Jeff Hubbard
Jeff, good to see an old face around every once in a while. I hope your doing well.
+2  A: 

Have a look at mono and Paint.Net

Mike Thompson
and NHibernate too!
Paint .Net is not open source ...
Sam Saffron
@Sam: yes, but Paint.NET license (http://www.getpaint.net/license.html) grants you the right to look at the source code. I could not find the source code for download on their download page, but as it's mostly a MIT license (except for very specific parts), you are allowed open Paint.NET in the Reflector and feast your eyes upon the innards of the beast. That's the next best thing to direct source code access.
+1  A: 

I think Mono could be a great place since the framework is built in C# itself. It might not fit your complexiity requoirement though

+9  A: 

SharpDevelop and Boo

Alexander Kojevnikov
+2  A: 

I would recommend you to take a look at xUnit for example. Scott Hanselman has a serios of posts where he recommends some source code to take a look at (usually managed code written in C#): source code category posts

David Pokluda
+6  A: 

NHibernate, rhino mocks, the castle project.

+28  A: 

Scott Hanselman's The Weekly Source Code series is a nice read, he got 30+ episodes already and his comment is posted up along with each post as well.

Just a suggestion,k you should hyperlink any references to maximize the usefulness. Thanks for the resource!
Somehow a link to google search was stripped out...
I was originally posting a link to hanselman's posts list and find that Google does a better job of indexing (as always) but SO doesn't seem to like it, so I edited link to hanselman's site back in.
Gotchya. Thanks again chakrit, i'm definately going to check these out.
+24  A: 

I'm sorry that my post won't answer on your question, but I just want to add my 2 cents.

I doubt you can find any project with extremely high quality of code :)

I would be happy to know if I'm wrong, but I believe that people answered on this questions name applications because of their quality for end-users not because they written in high quality code.

Real-world projects being created to solve problems not to show off beautiful code.

You will be amazed if you take a look at metrics of some well-known projects.

I don't remember exact link, but there was a NDepend analysis of popular projects such as Paint.NET. Results were, let's say quite disappointing, but those projects are still good at what they do.

I saw millions of lines of code in commercial and open-source projects. I didn't see any project with extremely high quality but those project solved their task.

High quality code is somewhat subjective and even mystical matter. I think it would be much more useful to seek for good solution for a specific problem.

For example, project X has some really good code to solve Y, but it sucks in implementation of Z.

To make my post less off-topic, I can recommend you to take a look at code written by Microsoft Patterns & Practices team.

For example:

These projects are being written by very proficient developers, and they are intended specifically to teach how to come up with good solutions for some problems.

But even those projects suck terribly in implementation of some things :)

You can say that about almost anything though. I think we can definately agree there is "bad" code.. and "not so bad code". I'm looking for the latter. So, when I say "extremely high quality code" I essentially mean code that doesn't suck, written by veterans and could expand my horizons a little
Awesome post, very helpful for me and I didn't even ask the question!

While I don't know about the actual code quality, you can have a look at the .NET Framework itself. At least they have FxCop and StyleCop running against it, since that's what the two tools were made for.

Visual Studio allows stepping into the BCL source, and there are some tools that misuse this functionality to download the entire source code. You can also look into the code with Reflector, since it is not obfuscated.

you don't even have to go through all that trouble ==> http://referencesource.microsoft.com/netframework.aspx (see also answer above)
+5  A: 

You can look directly at the .Net Framwork source available here: http://referencesource.microsoft.com/netframework.aspx

very good point here. I dindt even think of .net itself.
+3  A: 

The XNA Creators Club has some quite nice, open source code - even if you aren't interested in the XNA aspect. Each code sample is small enough to wrap your head around, and often have a very good design.

+7  A: 

I found the source for ASP.NET MVC to be a worthwhile read. At the time of writing, the latest source is avaliable to download on the preview 5 release page.

Paul Batum
+3  A: 

I would strongly recommend taking a look at Community Server. It is not an "Open Source" product per-se, but they provide a free Personal License and you can download the source for the entire system to muddle with.

Max Schilling
+1  A: 

If you want to see true art I'd recommend you to download Boo and check out. I recognize Rodrigo B. De Olivias to be probably among the best handful of men alive today in regards to code and quality...

When that's said, I'd definitely give Ra-Ajax a look too. I'm the creator of that stuff and there are very many places in there which I consider to have the "quality of Mona Lisa"...

To those saying that code quality and "pragmatism" doesn't necessarily go hand in hand, I would just like to say that you're wrong...!

Usefulness in most circumstances grows parallel in a one-to-one relationship with code code quality...!

Also often to determine code quality you can often count the number of lines of code, in general. The more complex the solution solved with less lines of code - the better the quality (normally)

Thomas Hansen
Too bad their download options are down and are being sued now :(
Hi Simucal, we're working on it and we hope to be up again soon ... :)
Thomas Hansen
Looks like the code is downloadable again
Sam Saffron
+1  A: 
Rinat Abdullin

MediaPortal. Individual sections of code are quite good, unfortunately it is not as cohesive as one might hope. There is an enormous amount of C# code covering everything from DB manipulation and XML manipulation to multimedia directshow programming and directx rendering.

+1  A: 

Another suggestion, if you're interested in medical imaging software is ClearCanvas. They've developed an open source medical imaging viewer, archive, and a radiology information system. More details and how to access the source can be found on the site.

They've developed an application framework for developing .NET desktop apps, which is used to develop the viewer and information system. There's also developer documentation to get you started for the viewer, if you'd want to customize it yourself.

Steve Wranovsky
+2  A: 

I would nominate the enterprise library which I maintain. Although it is virtually unknown :), it has been used on large project and performed really well. It is also FxCop compliant. It's called SixPack library.

+3  A: 

Check out Rotor and CSLA

Rotor is a shared source implementation (from MS) of portions of the .Net framework. CSLA is a nice Business Object framework for creating rich client and web apps.

Todd Stout
+1  A: 

John and Marc's MiscUtil is worth a look, the code is well commented and organized. It includes a large amount of tests.

Sam Saffron

Nunit and Lucene.net


AJAX Control Toolkit

+1  A: 
  • In case nobody mentioned it SubSonic - powerful open source .Net DAL
  • Blog Engine - It is web based blogging platform. Contains a lot of reusable asp.net 2.0 C# code + it is extensible enough for custom adjustments.
+2  A: 

I'm surprised no one mentioned Sharp Architecture

  • Focused on Domain Driven Design
  • NHibernate's best practices
  • MVC Framework
+1  A: 

What about DataObjects.Net? It's open-source commercial ORM + In-memory object database, seems to be quite interesting.

Alex Kofman
+1  A: 

Phalanger, a PHP to .NET compiler has some very high quality, well documented code.

Chris S
+2  A: 

I'm surprised no one mentioned Ninject or Siesta yet, Nate Kohari has impeccable taste in writing source code

Jeffrey Cameron
The Ninject link took me to a dead end .. believe it should be http://github.com/ninject/ninject, (or http://ninject.org/)
Thanks! Corrected now
Jeffrey Cameron

Personally, I've been amazed at what the people at the Kigg project have put together:


Really some amazing stuff to see as to how they tackle building a robust, modern C# app.

Nissan Fan
+1  A: 


Documented. High code coverage. Low warnings (including Code Analysis).