Review: Understand Your Variables
Visual Studio Magazine, Andy Clark
Total .NET XRef
Total .NET XRef from FMS is a simple-cross referencing tool that
helps you understand complex VB.NET and C# code. Cross-referencing tools
show you where your source code uses variables and other code items.
Total .NET XRef provides on-demand cross-referencing that integrates
fully into VS.NET.
XRef's straightforward installation procedure adds a tool window to
your projects that shows where your code references variables—including
line number, file, namespace, class, member, and character position. It
also previews the line where it locates the match and indicates the type
of match. The tool window is completely dockable: You can close it when
you're not using it and redisplay it from the Tools menu.
You simply highlight a variable, right-click on it, and select XRef
to examine how your code uses it. Total .NET XRef then compiles a list
showing every line that uses the variable and places the list in the
tool window, where you can click on any line to see how you've used the
variable throughout the project.
XRef doesn't do a simple search for the variable name. When you work
with a simple search, you see all references to a given string value,
and it's up to you to know which references are pertinent to your
current problem. In contrast, XRef ensures you're examining the same
data item. For example, if you do an XRef on a local variable named
Counter, you see only the use of this local variable, not local
variables by the same name in different methods or other items with the
Total .NET XRef also allows you to sort, group, and filter its
results. It works with parameters, fields, properties, constructors,
classes, modules, namespaces, operators, methods, and several other code
elements in addition to variables. It includes an option for exporting a
tool window to an HTML file for printing, but I was unable to get this
feature to work.
A minor limitation of Total .NET XRef is it works only with a
solution that compiles cleanly and only with one item at a time. It
would be great if it could let you parse your solution completely and
deliver an exhaustive cross-reference. Such an option would help you
verify naming conventions and check for spelling errors. I found FMS'
technical support to be competent, but a little slow.
A cross-referencing tool such as Total .NET XRef can be vital to
supporting large, complex systems, and a lifesaver when you maintain
other people's code. You can make changes with fewer unintended side
effects when you can see every place where the code uses a data item. If
you work with heavily used module-level variables or find yourself
changing frequently used methods, XRef can help you avoid making serious
About the Author
Andy Clark is a consultant with iGate Inc. in the Richmond, Va.,
area. He holds PMP, MCSD, and SJCP certifications. Reach him at
Back to Main Reviews Page