Adding a attribute class in .net is very simple.It's just a class declaration which inherits System.Attribute and is marked with AttributeUsage attribute.
[AttributeUsage(AttributeTargets.All)]
class MyAttributeClass : System.Attribute
{
//variables
//methods
}
once you declare this class you can use this as attribute in another class like following one
Class MySampleClass
{
[MyAttributeClass]
public void Dosomething()
{
}
}
More to come later...........
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment