Answers for "attribute usage c#"

C#
0

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
}
Posted by: Guest on May-21-2020

C# Answers by Framework

Browse Popular Code Answers by Language