Is there a general practice when it comes to how to organize your classes in C#? Should there only be one generic class per .cs file? I see that I have Form1.cs which includes all of the classes relevant to “Form1”. However I could create a file named Misc.cs which includes all misc classes. Not sure which way to go so everything stays organized.
Or should I organize them a specific way? For example, I am accessing a MySQL database, so i’m creating a MySQL wrapper which I will store in MysqlWrapper.cs and name the class to match it. Should I create a new .cs for each class I create?
Or should I combine only the ones that use similar “using” namespaces such as System.Text;
using System.Windows.Forms; etc?
Edit – this answer is meant to supplement the good answers that others have already posted.
Everyone else seems to be answering specifics. I’m thinking you’re going to have more “best practices” design questions.
The official guidelines can be found here: http://msdn.microsoft.com/en-us/library/czefa0ke(VS.71).aspx
In particular, dig into the Naming guidelines, and then into the Namespace Naming guidelines and Class Naming guidelines.
And, as others have mentioned, please, one class per file. It makes things easier on the poor maintenance developer who will follow you.