Stack OverflowOpen source C# projects that have high code quality?
[+140] [31] Simucal
[2008-09-27 05:57:57]
[ c# open-source ]


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:

Shouldn't this be community wiki? - George Stocker
it probably should be a community wiki. - Lamar
Yea, this is a pretty old question. Back before that was done very often. Converted to community wiki. Thanks for the answers everyone! - Simucal
Mono has the most bizarre coding standards I've ever seen. They're totally different to the way Visual Studio formats C# code. - U62
@sambo99, good edit, I agree they should explain it. - Simucal
[+33] [2008-09-27 06:10:32] chakrit

Scott Hanselman's The Weekly Source Code [1] 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! - Simucal
Somehow a link to google search was stripped out... - chakrit
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. - chakrit
Here's a better link:… - chakrit
Gotchya. Thanks again chakrit, i'm definately going to check these out. - Simucal
[+29] [2008-09-27 06:11:41] aku

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 [1] 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 :)


(4) 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 - Simucal
Awesome post, very helpful for me and I didn't even ask the question! - Rayne
[+10] [2008-09-27 06:05:45] Alexander Kojevnikov

SharpDevelop [1] and Boo [2]


[+10] [2009-05-27 07:13:36] Patrick from NDepend team

Here are some quality/structuring/changes analysis I did with NDepend [1]

.NET Fx 4.0 beta1 vs 3.5 SP1 [2]
SharpDevelop [3]
CruiseControl.NET [4]
NUnit [5]
Mono vs .NET Fx [6]
Silverlight vs. .NET Fx [7]
NHibernate [8]
.NET 3.5 SP1 vs 3.5 [9]


[+7] [2008-09-28 12:51:11] Paul Batum

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


[+6] [2008-09-27 06:08:02] Kurt

NHibernate [1], rhino mocks [2], the castle project [3].


[+5] [2008-09-27 10:26:48] Nico

You can look directly at the .Net Framwork source available here:

very good point here. I dindt even think of .net itself. - mattlant
[+3] [2008-09-28 12:33:16] Spodi

The XNA Creators Club [1] 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.


[+3] [2008-10-23 17:45:59] Max Schilling

I would strongly recommend taking a look at Community Server [1]. 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.


Having done quite a bit of work with Community Server I still see it's source code in my nightmares. - aboy021
[+3] [2009-04-11 01:59:05] Todd Stout

Check out Rotor [1] and CSLA [2]

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.


[+2] [2009-03-15 01:23:56] Sklivvz

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 [1].


[+2] [2009-05-26 07:02:27] Darnell

I'm surprised no one mentioned Sharp Architecture [1]

  • Focused on Domain Driven Design
  • NHibernate's best practices
  • MVC Framework

[+2] [2009-09-05 22:43:59] Jeffrey Cameron

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


The Ninject link took me to a dead end .. believe it should be, (or - bryan_cook
Thanks! Corrected now - Jeffrey Cameron
[+2] [2008-09-27 06:07:51] David Pokluda

I would recommend you to take a look at xUnit [1] 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 [2]


[+2] [2008-09-27 06:02:34] Mike Thompson

Have a look at mono [1] and Paint.Net [2]


and NHibernate too! - SoloBold
Paint .Net is not open source ... - Sam Saffron
@Sam: yes, but Paint.NET license ( 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. - Sylverdrag
[+1] [2008-09-27 06:03:09] mattlant

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


[+1] [2008-11-22 21:09:16] Thomas Hansen

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 [1] 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)


Too bad their download options are down and are being sued now :( - Simucal
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] [2008-12-13 17:05:46] Rinat Abdullin

[+1] [2009-05-28 11:30:10] Alex Kofman

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


[+1] [2009-09-01 11:50:06] Chris S

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


[+1] [2010-05-23 19:33:29] brickner

Pcap.Net [1].

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


[+1] [2009-04-14 06:46:35] YordanGeorgiev
  • In case nobody mentioned it SubSonic [1] - powerful open source .Net DAL
  • Blog Engine [2] - It is web based blogging platform. Contains a lot of reusable 2.0 C# code + it is extensible enough for custom adjustments.

[+1] [2009-01-16 15:26:55] Steve Wranovsky

Another suggestion, if you're interested in medical imaging software is ClearCanvas [1]. 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.


[+1] [2009-04-12 10:35:04] Sam Saffron

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


[0] [2010-04-16 22:48:38] Cat Man Do

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.

[0] [2008-12-26 23:32:39] community_owned

MediaPortal [1]. 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.


[0] [2008-12-03 06:26:07] Kirill Osenkov
[0] [2008-09-27 06:01:43] Rayne 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 [1]


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. - mattlant
I've heared of you before. - Rayne
Matt! Long time no talk! - Jeff Hubbard
Ah, my posts are reuniting old friend's. Glorious - Rayne
thanks, both of these bots look interesting. - Simucal
Your welcome only one of those is a bot however, the other is a maphack. - Rayne
Jeff: lord2800 iirc? If I am wrong, i apologize, i dont remember 'real' names too well :/ - mattlant
@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. - Simucal
Oh, I thought you were refering to the links I mentioned. - Rayne
@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. - mattlant
[0] [2008-09-27 08:26:12] OregonGhost

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.

(1) you don't even have to go through all that trouble ==> (see also answer above) - fretje
[-1] [2009-04-12 11:46:53] Tomh

Nunit [1] and [2]


[-1] [2009-04-12 12:26:01] Yassir

AJAX Control Toolkit [1]