stovellp Posted March 30, 2004 Posted March 30, 2004 Howdy, I have a class called DBResult, which resides in the namespace Stitch.Database. There is another class in the Stitch.Database namespace, and an enum with three values. Should I keep each class in a seperate file? What about the enum? And whats a general way to name the files? For instance, should DBResult reside in the file Stitch.Database.DBResult.cs? Thanks for any help :) Quote
*Experts* Nerseus Posted March 30, 2004 *Experts* Posted March 30, 2004 Generally, each namespace is a separate folder and you have one class per file. There's no hard and fast rule though - it's up to you. If classes are VERY related it's generally a good idea to keep them together in the same file. You may also want them in the same file if they're very small. Personally, I like every class in its own file with a few, very rare exceptions. For namespaces, assume your project is in c:\projects\Stitch. There should be a folder named c:\projects\Stitch\Database and the DBResult.cs lives in this folder. If you create the folders in Visual Studio and then add a file, the new class will have it's namespace default to using the folder name as an added level to the namespace. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.