Organizing Namespaces

Suggestion #1:  Find instances of exact namespaces.

While files and namespaces are typically 1-to-1, it would be helpful if we could find other instances of a namespace.

For example, in VS2012 with MVC4, we now have files in the App_Start folder with the same namespace as the root of the project, and the Global.asax file.  This is how the new OAuth system for social authentication works.  If this is becoming a convention, it would help to find all instances of an exact namespace, since files will be spread out among various folders.

As a second example, assume you have created extensions for Collections.  These extensions may exist in multiple folders, but all tie to "System.Collections.Generic".  It would be helpful to find only "my code" regarding this namespace.  Right now, "Find Usages" finds all of the "using" statements and several other instances, but doesn't actually search for exact namespace matches.

Suggestion #2:  Move a file to the directory specified in the namespace (create if necessary).

Example:  When I create ReSharper templates, I will generate multiple layers of boilerplate code that we use as a standard for our solution.  While the template works fantastic, there is a problem.  The namespaces, while correct, don't have an option to be "exported to".  So, imagine you generate a database POCO and want to "send/export it" to the namespace/folder you use for all of your database POCOs.  How would you do that?  The easiest method I can think of is to just "export/move/send" the file to the location of the listed namespace.  So, just as we can move all classes in a single file to their own files, why not also allow us to move namespaces to their associated directories?  As a side note, that directory may or may not already exist.

1 comment

I found that Suggestion #1 is possible with Ctrl+Shift+Alt+B (Go To Implementation) on the namespace name.


Please sign in to leave a comment.