I just wanted verification on this. If I use custom attributes to document bug fixes in my code, will that effect run-time performance
[BugFix("01/01/07", "Fixed problem with calculation...")]
[BugFix("01/04/07", "Added error-handling....")]
public void MyMethod()
{
................

Attributes
Gunston
Fran&#231&#59;ois296449
I could use the XML comments, but I could also use the attributes, since they will generate with the SandCastle documentation. Also it allows the possibility of building a utility to pull the code modifications out into a report all by itself via reflection.
lamont_23
CGuyArun
You could use the XML /// comments and pull them out of the generated XML also. I kind of like the attribute better because it is easier to create because of the intellisense.
///<bugfix>Fixed bug</bugfix>
I can send you the custom attribute I created for this later today. I assume it just gets compiled into the Metadata and doesn't affect the performance much at run-time, except for a slighlty larger assembly.
Triangle1408
spattewar
I just think the idea of getting bug fixes through reflection is kind of cool, you could build a class browser like the one smalltalk uses that displays the bug fixes and other related metadata, actually I think I'll do that myself.
Kinetic Media
O'Reilly gives the Bug Fix as an example of using an Attribute, so i guess it is OK
http://www.oreilly.com/catalog/progcsharp/chapter/ch18.html .
Custom Attributes
You are free to create your own custom attributes and use them at runtime as you see fit. Suppose, for example, that your development organization wants to keep track of bug fixes. You already keep a database of all your bugs, but you'd like to tie your bug reports to specific fixes in the code.
You might add comments to your code along the lines of:
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:
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.