Usage of Attributes

Gopesh9
Posted by Gopesh9 under C# category on | Points: 40 | Views : 973
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;


namespace attributes
{
[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]

public class Bugfixingattribute : Attribute
{
private int bugno;
private string developer;
private string datefixed;
public string remarks;
public Bugfixingattribute(int _Bugno, string _Developer, string _Datefixed)
{

this.bugno = _Bugno;
this.developer = _Developer;
this.datefixed = _Datefixed;
}
public int Bugno
{
get
{
return bugno;
}
}
public string Datefixed
{
get
{
return datefixed;
}
}
public string Developer
{
get
{
return developer;
}
}
public string Remarks
{
get
{
return remarks;
}
set
{
remarks = value;
}
}
}
[Bugfixingattribute(125, "saralevo", "08/15/06", Remarks = "return object not specified")]
[Bugfixingattribute(159, "saralevo", "08/17/06", Remarks = "data type mismatch")]
public class Calculator
{
public double Add(Double num1, Double num2)
{
return num1 + num2;
}
public double Subtract(Double num1, Double num2)
{
return num1 - num2;
}
[Bugfixingattribute(155, "saralevo", "08/16/06")]
public double Divide(Double num1, Double num2)
{
return num1 / num2;
}
}
public class Entrypoint
{
public static void Main(string[] args)
{
Calculator ob = new Calculator();
Console.WriteLine("the sum of specified two no's are:{0}", ob.Add(89.9, 20.5));
Console.ReadLine();

}
}
}

Comments or Responses

Login to post response