The way I will describe is a use of Custom Attribute. Suppose, your organization wants to keep track of bug fixes and you have your own BugTracking system or a database to keep all of your bugs, but you’d like to attach your comment on specific code that you have been fixed and get them as a list to put in database whenever you like. This example describe how to attach bug information to a class and get them by your code.
Generally when you fixed a bug then add comments to your code like this:
// Bug 323 fixed by Mamun on 17/2/2008.
This would make it easy to see in your source code, but there is no enforced connection to Bug 323 in the database. A custom attribute might be just what you need. You would replace your comment with something like this:
[BugInformation(323,"Mamun","17/2/2008") Comment="Off by one error"]
You could then write a program to read through the metadata to find these bug-fix notations and update the database. The attribute would serve the purposes of a comment, but would also allow you to retrieve the information programmatically through tools you'd create.
Part-II, Part-III
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment