Free Resources from FMS

Additional Resources

 

Thank you! Thank you! I just finished reading this document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.

Darren D.

 

Free Catalog

 

The Obsolete attribute

Provided by: Dave Juth, Senior Systems Architect

The Obsolete attribute is useful for refactoring and general management of your project’s source code over the development lifecycle. The .NET compiler generates warnings at compile time for code marked obsolete. For example, you may have a method that performs some task but will no longer be required once some milestone is reached in your development cycle. Since you know you will want to remove this code, marking the method with the Obsolete attribute will be a constant reminder for you that its removal is pending:

C#:

[Obsolete("This method will be removed when database migration is complete.")]
public void ReplaceOldSprocs() {
// code...
}

VB.NET:

<Obsolete("This method will be removed when database migration is complete.")> _
Public Sub ReplaceOldSprocs()
' code...
End Sub

When you compile the project, you will see a build error (reported as a warning, not an error) in your Visual Studio .NET Task List window:

SomeClass.ReplaceOldSprocs() is obsolete: ‘This method will be removed when database migration is complete.’

You can also use a product such as Total .NET Analyzer to find methods that are defined but never called, as well as much more to help you create higher quality software.

Return to the tips page