attributeusage c# code example

Example: attribute usage c#

//The AttributeUsage attribute enables you to control:
//- Which program elements attribute may be applied to. ...
//- Whether an attribute can be applied to a single program element multiple times.
//- Whether attributes are inherited by derived classes.

//Here is an example:
using System;

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, inherited = true)]
public class MyClass : Attribute // or any other class that somehow implements Attribute
{
	//Do stuff
}