KnowDotNet NetRefactor

Visual Class Organizer

One of the most fundamental tenants of .NET Basics is to keep your code windows organized, readable, easy to navigate, and easy to maintain.  Visual Class Organizer takes the work out of keeping your VB.NET and C# Code Windows organized.  Visual Class Organizer provides a powerful, sophisticated tool to allow you to quickly and easily organize your code into logical groups of code elements, sort them alphabetically, and surround them with Regions.  You don't have to Cut and Paste to move code around any more. Visual Class Organizer will display your code in a visual format and let you visually organize your code, in a variety of ways. And, better than that, Visual Class Organizer can automatically organize your Code Window with just a couple of mouse clicks!

Check out the feature list shown below and see the details of any feature by clicking the link associated with the feature.  You can scroll to the Class Organizer Dialog below or click Class Organizer Dialog

To Purchase or Try Visual Class Organizer FREE for 30 days by Clicking Here.

To see a demonstration of Visual Class Organizer, Click Here.



Class Organizer Dialog

The Class Organizer Dialog is where the majority of the features of Visual Class Organizer reside.  To load this dialog, simply place the cursor anywhere in a VB.NET or C# Code Window and right-click the mouse to open the IDE context menu.  From the Visual Class Orgainzer menu, select Class Organizer.  From this dialog, you can visually organize, sort, and regionize your code elements, making your code window appear as you desire before saving the code back to the Code Window.  The picture below shows the Class Organizer Dialog.  The second picture describes the most often used Tool Buttos.

Class Organize Dialog


Class Organizer Tool Buttons


Tool Bar Buttons


Top of Page



Drag and Drop Code Elements


Generally, the elements that can be Dragged are methods, variables, delegates, events, etc.  You can Drag whole Regions, Classes, and Namespaces, but you must select both the start and end of these containers.  In other words, to drag a Class, select the Class and End Class, along with all items between them.  However, a nested Class cannot be dragged out of the Class in which it resides.  Also, a Class can't be dragged out of the Namespace in which it resides.  Additionally, Global Compiler Directives, Option Statements, Inherits, and Implements cannot be dragged.  Any of these invalid operations would break your code.  A complete construct of compiler directives and such as an #IF/ #End If, and all of the code contained within the construct is an exception to the rule and can be moved.


Once you have selected the desired items, left-click over a name in the selection and drag either up or down.  The ListView will automatically scroll if you are dragging into items that are hidden.  The status bar will tell you, but if you are dragging up, the items being dragged will be inserted above the item on which you drop.  Conversely, if you are dragging down, the dragged items will be inserted below the item on which you drop.



Top of Page



Surrounding Code With Regions

Surrounding one or many Code Elements in a #Region is accomplished by two simple steps.  First, select the items that you wish to surround with a #Region.  Next, select "My Regions" in the Region ListView, on the right side of the Class Organizer Dialog, if not already selected, and double-click the desired region name.  The "My Regions" list can be added to or deleted from.  The picture shown below depicts the process just described.


Select Items to Surround


Encapsulating in Regions


Surround With Region


Encapsulating in Regions2


Nested Regions


Visual Class Organizer supports manual nesting of regions.  Select the existing regions and double-click the region in which to nest the selected regions.  The result is shown below.


Encapsulating in Regions


Top of Page



Sorting Items in the Class Organizer Dialog


You can sort any number of items by selecting the items to be sorted and clicking the Sort Tool Button.  Regions, including the #Region and #End Region, cannot be sorted.  Only the contents of a Region can be sorted.  The whole Region can be dragged and dropped.  The pictures shown below depict the sort process.

Sort Items1

Sorted Items


Sorting Items2

Items Optionally Surrounded with  Region


Sorting Items 3


Top of Page

Collapsing and Expanding Regions


Regions lines, in the ListView will have an Icon of either a Plus or Minus sign.  This means that they can be Expanded if there is a Plus Icon on the line or Collapsed if there is a Minus Icon on the line.  When you have very large amounts of code in a code window, moving Regions of code around would be very difficult.  Class Organizer provides the ability to Collapse one region or by clicking the Minus icon on a Region line.  By clicking he Minus Tool Button on the Tool Bar, you can Collapse all Regions.  Conversly, you can expand one or all by clicking the respective Plus Icon or Tool Button.  The picture shown below depicts the process.


Collapse and Expand Regions


Top of Page




Auto Organizing Your Code


You can automatically organize your code using the power of the Class Organizer Dialog.  First, because of the variety of items that may appear in a VB.NET or C# Code Window, you must select the items to be automatically organized.  Generally, the elements that can be selected are methods, variables, delegates, events, etc.  You cannot Auto Organize whole Namespaces, or Regions, but you can Auto Organize a single whole Class, as long as there are no Classes nested within it.  Additionally, you can't organize global compiler directives, such as #If, #Else, #End If, or code items within them as a block.  Directives, Option Statements, Inherits, and Implements cannot be dragged.  Please note the exception to this rule under the section on Drag and Drop.


To Auto Organize, select as many items as you desire, excepting those previously mentioned.  Next, select the Auto Organize option desired, from the Tool Bar.  Auto Organizer will do the rest.  The following pictures depict the simple steps and their results.  If it is desirable to Auto Organize a whole Class, simply right-click on the Class item and choose the desired Auto Organize option.  That capabality is shown in the following images.


Auto Organizing Steps


Auto Reorg1

Auto Organizing Complete


The image shown below depicts the selected Class after it has been Auto Organized.  You will note that all code items, except the Inherits and Implements, have been grouped, sorted alphabetically, and surrounded by Regions.  The names and order of the Regions is completely customizable through the use of the Region Customize Dialog which can be invoked from the Class Organizer Dialog.


AutoReorg2


Expanding Regions


AutoReorg3


Top of Page


Try Visual Class Organizer for Visual Studio 2005/2008 for FREE for 30 days.  To Download the Free, fully featured Trail Version, Click HERE.



Introductory Special - Purchase Registration Key for one copy of Visual Class Organizer for $39.





Purchase 5 Seat License for Visual Class Organizer  for $159.





Purchase Site License for Visual Class Organizer for $389.





Version 1.1.45, dated 11/6/2007, is the latest version available for download.  To see description of changes by release version, Click Here.
Top of Page

Writing Add-Ins for Visual Studio .NET
Writing Add-ins for Visual Studio .NET
by Les Smith
Apress Publishing