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:
01124418
Vues:
7
This message has been marked as a message which has helped to the initial question of the thread.
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



>Hi all,
>
>Coding in C#, which is a better practice: put one class per file and allow the file share the same name as class name (like in Java) or put multiple classes in a file (like in VFP)?
>
>I'm inclined toward the former since it's easier to find a class by just looking at the file name.
>
>Any suggestions or comments will be appreciated!
Bonnie Berent DeWitt
NET/C# MVP since 2003

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

Click here to load this message in the networking platform