blob: 90112f5c33576b326f29a9d6a55b71f77ff4b737 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
using System;
public class TestAttribute : Attribute {
Type type;
public TestAttribute(Type type)
{
this.type = type;
}
public Type Type
{
get { return type; }
}
}
[TestAttribute(typeof(void))]
public class Test {
public static void Main()
{
object[] attrs =
typeof(Test).GetCustomAttributes(typeof(TestAttribute), false);
foreach (TestAttribute attr in attrs) {
Console.WriteLine("TestAttribute({0})", attr.Type);
}
}
}
|