C# classes in separate files? [closed]

While the one class per file policy is strictly enforced in Java, it’s not required by C#. However, it’s generally a good idea.

I typically break this rule if I have a very small helper class that is only used by the main class, but I prefer to do that as a nested inner class for clarity’s sake.

You can however, split a single class into multiple files using the partial keyword. This is useful for separating your code from wizard-generated code.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)