Migarting the mbas' negative test cases from the old folder to here.
[mono.git] / mcs / mbas / Test / errors / AttributesC2.vb
1 REM LineNo: 19
2 REM ExpectedError: BC32035
3 REM ErrorMessage: Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.
4
5 Imports System
6
7 <AttributeUsage(AttributeTargets.All)> _
8 Public Class AuthorAttribute 
9      Inherits Attribute
10         Public Name
11         Public Sub New(ByVal Name As String)
12                 Me.Name=Name
13         End Sub 
14 End Class
15
16
17 <Author("Robin Cook")> _
18 Public Class C1
19         <Author("John")> _
20
21 End Class
22
23 Module Test
24         Sub Main()
25
26                 Dim type As Type=GetType(C1)
27                 Dim arr As Object()=type.GetCustomAttributes(GetType(AuthorAttribute),True)
28                 If arr.Length=0 Then
29                         Console.WriteLine("Class has no attributes")
30                 Else
31                         Dim aa As AuthorAttribute=CType(arr(0),AuthorAttribute)
32                         Console.WriteLine("Name:" & aa.Name)
33                 End If
34         End Sub
35 End Module