Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A class per file or multiple classes per file?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01124405
Message ID:
01124577
Vues:
7
You're welcome Dawa. =)

~~Bonnie


>>Hey Dawa,
>>
>>Here's my favorite answer ... it depends!!!! <g>
>>
>>I will often put several non-visual classes in one class library (one file) and for visual classes it's usually one class per file. A notable exception being my class library that sub-classes all the UI controls ... you know, TextBox, ComboBox, etc. Though these are visual objects, they can't be sub-classed visually and since there's potentially not much code in some of those sub-classes, I don't find it a very good idea to have a file for each class.
>
>Bonnie,
>
>I'm also realizing that by putting one class per .cs file, I'd see a longer list in the project explorer too.
>
>I guess the point is to come up with a method to group classes in a logical unit based on certain princeples or perpose or needs. As you say, for sub-classed UI controls, it does seem tidy to have them in one .cs file. Then once the project is built into a DLL. The controls may be shared.
>
>Some of the princeples may be:
>Code sharing
>Team communication (code documentation)
>Code maintainance
>Upgrade with Ease (only upgrade the DLL that is modified)
>
>Thanks again for your contribution!
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform