Search code examples
.netwpfvisual-studionamespacesprojects-and-solutions

Best Practices - WPF Custom Control Library - Organizing files, folders and namespaces


So I have a WPF custom control library with a few controls.

Some of the controls are quite complex and need multiple files stuffed into their own folders. Namespaces also imitate the folder structure, so I have namespaces like SomeControl.SomeControl etc. Some controls are trivial with just one file in the top level folder. I think its all really ugly but I don't know whats not!

Any rule of thumbs when organizing a custom control library both folders and namespaces?


Solution

  • Namespaces should not be named based on folder hierarchy but based on there functionality etc. -

    The name chosen for a namespace should indicate the functionality made available by types in the namespace

    have a look at this MSDN article for guidelines for naming Namespaces

    Names of Namespaces: http://msdn.microsoft.com/en-us/library/ms229026.aspx

    Other similar questions on SO -

    namespace naming conventions

    Good Namespace Naming Conventions