2 Imports System.Reflection
\r
7 <AttributeUsage(AttributeTargets.All, Inherited:=True, AllowMultiple:=True)> _
\r
8 Public Class Annotation
\r
9 Inherits System.Attribute
\r
11 Protected strAuthor As String
\r
12 Protected strComment As String
\r
14 Public Sub New(ByVal Author As String, ByVal Comment As String)
\r
16 strComment = Comment
\r
19 Public Property Author() As String
\r
24 Set(Value As String)
\r
25 strAuthor = CStr(Value)
\r
29 Public Property Comment() As String
\r
33 Set(Value As String)
\r
34 strComment = CStr(Value)
\r
40 <Annotation("mr-", "AttributeTest")> _
\r
41 Public Class TestClass
\r
42 Public Sub New(a As integer,b As integer,c As integer)
\r
46 Public Sub SayWhoYouAre()
\r
51 Public Class TestClass2
\r
52 Public Sub New(a As integer,b As integer,c As integer)
\r
56 Public Sub SayWhoYouAre()
\r
67 Dim obj(1) As Object
\r
68 Dim MyAnnotation As Annotation
\r
70 tc = New TestClass(2,3,4)
\r
71 tc_type = tc.GetType()
\r
72 obj = tc_type.GetCustomAttributes(False)
\r
73 MyAnnotation = CType(obj(0), Annotation)
\r
75 Console.WriteLine(TestUtils.GenerateHash(MyAnnotation.Author & MyAnnotation.Comment))
\r