Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm a C# programmer and I'm interested in reading well written C# code. I've read somewhere that reading good code is like reading a good book (and educational too!).

My interests:

  • Game programming
  • ASP.NET MVC razor
  • databases

I'm not really looking for a specific kind of program to read, any well written program will make a nice bedtime story :-)

share|improve this question

migrated from stackoverflow.com Nov 23 '11 at 22:56

closed as not constructive by Mark Trapp Dec 12 '11 at 17:37

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

7 Answers

Take a look at Microsoft's App Hub, lots of code samples for game programming using XNA.

share|improve this answer

ravendb is an open source database and racoonblog is a blog engine built on top of it using mvc

mvc music store is also a great example and comes with a pdf ( 160 pages ) explaining it.

share|improve this answer
Thanks for the mvc music store link! That PDF looks like a good read for the train... – Jim Jan 5 '12 at 22:21

funnelweblog is a great example of an MVC3 App.

FunnelWeb is an open source blog engine, built by developers for developers.

The source is available on Bitbucket and is very easy to follow (once you have your head around autofac :p)

Another great example is RavenDB which is the only commercial C# product that releases the source code (that I am aware of). This is a fantastic example of how a real-world application is structured (with unit and integration tests)

share|improve this answer

ASP.NET Code Samples Collection is a great collection of ASP.net code samples including MVC, Data Access and a couple of Games

share|improve this answer

Don't just read code, also try to think about how you would improve it yourself. A perfect candidate for this is Code Review. Follow the C# tag there and see how other people improve posted code samples, or jump right in and see how you can improve the code yourself.

To learn how to structure big projects you are probably better of browsing for any often used open-source (or even non-open source) libraries and see how they are structured. Or again, try writing a framework yourself, or extend an existing one and ask for feedback on Code Review.

share|improve this answer

Microsoft provides an open source community projects page with a collection of well written c# software, you can found here:

http://www.asp.net/community/projects#jm_open_source_applications

share|improve this answer

MSDN for raw C# and .NET framework.

C# is not appropriate for game programming. Try C++

share|improve this answer
4  
C# is fine for game programming with the XNA framework. – Anna Lear Nov 24 '11 at 1:28
Serious games? Such as Skyrim or Battlefield 3 developed in C#? – BilgehanKorkmaz Nov 24 '11 at 10:49
4  
There's a lot more to gaming than the big titles and you're not gonna be learning game programming by reading Skyrim's source. – Anna Lear Nov 24 '11 at 13:27
Asset management, memory management, shader programming, gpu performance tricks, cpu optimization, multiplatform development - android, mac os x, linux, etc - etc... C# is not a realistic solution for this work. – BilgehanKorkmaz Nov 24 '11 at 14:25
@BilgehanKorkmaz your notion of "serious games" accounts for a very small portion of the global videogames market. Time for a reality check. – MattDavey Aug 10 '12 at 12:31