functions not used...

T

topdawg147

This question might be for another group, but since I use vb.net, I
thought I'd ask here....

I'm looking to clean up some code. Is there a development tool to tell
me which functions are not being used? I know that in C#, the compiler
will tell you which variables are not being used. However, I need this
for functions/methods/properties in VB.NET.

thanks,
Todd
 
M

Marina

You can just search the whole project in VS.NET for that
function's/property's name. If you don't find anything that calls it, then
there you are.
 
T

topdawg147

I would have tried this, but it's a huge project with about 150,000
lines of code. I didn't want to look at each method/property and then
do a search for its name.

Thanks anyways,
todd
 
J

Jay B. Harlow [MVP - Outlook]

Todd,
In addition to the other comments.

I don't know of a quick report that tells you if a function is used or not.
(other then the FxCop one).

When I have a function I suspect is not used or one that I want to get ride
of, I put the Obsolete attribute on it, if any errors or warnings are
produced I remove the attribute. If no errors & warnings are produced I go
ahead & remove the function.

Be mindful of public functions in class libraries, as users consuming your
class library may use the function. The Obsolete attribute has overloaded
parameters for error or warning along with what message to display.

Something like:

' cause an error with a specific message
<Obsolete("This function should not be used any more", True)> _
Public Function SomeOldFunction() As Boolean
Return False
End Function

' cause warning with a specific message
<Obsolete("This function should not be used any more")> _
Public Function SomeOldFunction() As Boolean
Return False
End Function

' cause an obsolete warning
<Obsolete()> _
Public Function SomeOldFunction() As Boolean
Return False
End Function


--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net


| This question might be for another group, but since I use vb.net, I
| thought I'd ask here....
|
| I'm looking to clean up some code. Is there a development tool to tell
| me which functions are not being used? I know that in C#, the compiler
| will tell you which variables are not being used. However, I need this
| for functions/methods/properties in VB.NET.
|
| thanks,
| Todd
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top