How do you organize C# code in to files?

In C#, the questions of what types to create, what members they should have, and what namespaces should hold them, are questions of OO design. They are not the questions I'm interested in here.

Instead, I want to ask how you store these in disk artifacts. Here are some example rules:

  • Put all of an assembly's types in a single source file. One friend who did this said "files are an archiac code organization tool; today I use classview and Collapse to Definitions to browse my code".

  • Put all your code in one assembly. Makes deployment & versioning simpler.

  • Directory structure reflects namespace structure.

  • Each namespace gets its own assembly.

  • Each type goes in its own assembly. (Listed as an extreme example.)

  • Each type gets its own source file.

  • Each member gets its own file; each type gets its own directory. (Listed as an extreme example.)


Whatever you do, just PLEASE do it consistently. I don't believe there is any one single answer (though there are a few wrong ones). But just make sure you stay true to your form as this will be the key for your successor(s) to find things easily.

Need Your Help

Postgresql add rule to column to transform data on select

sql postgresql select postgis

I want to have a column that stores data in one format (Postgis geography format), but whenever it is subjected to select query, it should be transformed with function and returned in another forma...

Apple iOS6 Maps - Destination Address > Business name showing instead of lat/long

iphone objective-c ios ios6

I have an app that bumps the user out to Apple's maps to get directions to a business location, and I'm passing lat/long. Pretty simple, the URL I'm using is the following:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.