Sunday, February 17, 2008

Get the list of bugs that you have fixed during development. [Part-III]

And finally here is your implementation.

using System;
using System.Collections.Generic;
using System.Text;
using FindBug.Entity;

namespace FindBug
{
public class Program
{
static void Main(string[] args)
{
MyCodeWitBugFixing mm = new MyCodeWitBugFixing();
Console.WriteLine("Calling SumTwoDigit(7, 3). Result: {0}", mm.SumTwoDigit(7, 3));
// get the member information and use it to retrieve the custom attributes
System.Reflection.MemberInfo inf = typeof(MyCodeWitBugFixing);

object[] attributes;
attributes = inf.GetCustomAttributes(typeof(BugInformation), false);

// iterate through the attributes, retrieving the properties
foreach (Object attribute in attributes)
{
BugInformation bfa = (BugInformation)attribute;
Console.WriteLine("\nBugID: {0}", bfa.BugID);
Console.WriteLine("Programmer: {0}", bfa.Programmer);
Console.WriteLine("Date: {0}", bfa.Date);
Console.WriteLine("Comment: {0}", bfa.Comment);
}
}
}
}

Put all code together and test it. Hope you will like it.

Part-I, Part-II

No comments: