Question

In Eclipse there is a way to switch the representation mode of packages via a given ide menu. Please take a look at the screenshots i have made to illustrate this. The screenshots show a hiearchy of packages, each containing one element.

  • Hierarchial:

  • Flat:

Is Visual Studio's Solution Explorer able to switch the hierarchial representation mode of namespaces into a flat one?

Note: I am really only referring to the "representation" of the namespaces. I am not intended to change the namespaces' names or hierarchies in any way!

Motivation: When dealing with larger projects where mixed contents is laid up in several namespace depths there comes a point when this things need to be reorganized. Lets say you have a couple of t4 templates with input and output files together in one namespace. Then things start to grow... you know the rest ;) Break up the big ball of mud (pattern) using SOC and usually the information inside one single file is not that helpful at that state. You see there are 20 files which should go into another NS and so on.

Maybe I am missing something really obvious here. I have already searched for plugins but it is really difficult to find something which matches this really specific topic in particular.

I am using Visual Studio 2012 Professional

Was it helpful?

Solution

I do not know of a built-in way to do this in Visual Studio's Solution Explorer, which is where I presume you would like the option.

I also searched for a VS extension that adds this option to Solution Explorer and did not find one either. Even VSCommands' Solution Explorer enhancements does not seem to offer this option.

Now what you might consider is using Visual Studio's Object Browser (View > Object Browser or Ctrl+W, J) with its View Namespaces option enabled (its default being View Containers):

Visual Studio 2012's Object Explorer with

Scoped to My Solution, this seems to provide the flattened-namespaces view of a solution that you want.

UPDATE:

Following comments below, note that double-clicking types and members in Object Browser will open them to view & edit their code - similar to double-clicking files in Solution Explorer.

To help with switching between Solution Explorer and Object Browser, consider a couple possibilities.

1) Pin the Object Browser tab (and consider displaying pinned tabs in their own row via Visual Studio's Tools > Options > Environment > Tabs and Windows > "Show pinned tabs in a separate row" (under the Pinned Tabs section of Tabs and Windows options)):

Code Viewing & Editing with Object Browser as a Pinned Tab

2) Dock Object Browser with Solution Explorer, below it etcetera - especially if you have a lot of screen real estate:

Code Viewing & Editing with Object Browser Docked Like Solution Explorer

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top