**** Merged from MCS ****
[mono-project.git] / mcs / mbas / testsuite / attrtest.vb
blobbc6fa11812bf6da3f515375dece7df25da06cdad
1 Imports System
2 Imports System.Reflection
3 Imports TestUtils
5 Namespace Pippo
7 <AttributeUsage(AttributeTargets.All, Inherited:=True, AllowMultiple:=True)> _
8 Public Class Annotation
9 Inherits System.Attribute
11 Protected strAuthor As String
12 Protected strComment As String
14 Public Sub New(ByVal Author As String, ByVal Comment As String)
15 strAuthor = Author
16 strComment = Comment
17 End Sub
19 Public Property Author() As String
20 Get
21 Author = strAuthor
22 End Get
24 Set(Value As String)
25 strAuthor = CStr(Value)
26 End Set
27 End Property
29 Public Property Comment() As String
30 Get
31 Return strComment
32 End Get
33 Set(Value As String)
34 strComment = CStr(Value)
35 End Set
36 End Property
38 End Class
40 <Annotation("mr-", "AttributeTest")> _
41 Public Class TestClass
42 Public Sub New(a As integer,b As integer,c As integer)
44 End Sub
46 Public Sub SayWhoYouAre()
48 End Sub
49 End Class
51 Public Class TestClass2
52 Public Sub New(a As integer,b As integer,c As integer)
54 End Sub
56 Public Sub SayWhoYouAre()
58 End Sub
59 End Class
61 Module Test
63 Dim tc As TestClass
65 Public Sub Main()
66 Dim tc_type As Type
67 Dim obj(1) As Object
68 Dim MyAnnotation As Annotation
70 tc = New TestClass(2,3,4)
71 tc_type = tc.GetType()
72 obj = tc_type.GetCustomAttributes(False)
73 MyAnnotation = CType(obj(0), Annotation)
75 Console.WriteLine(TestUtils.GenerateHash(MyAnnotation.Author & MyAnnotation.Comment))
76 End Sub
78 End Module
80 End Namespace