**** Merged from MCS ****
[mono-project.git] / mcs / mbas / Test / tests / WithStatementC.vb
blobe2be9914dc8697c9d4dc0dc77b8e3cd5ccfc3dce
1 Imports System
3 Module WithStatementC
4 Class C1
5 Public a1 As Integer = 10
6 Public a2 As String = "Hello"
7 Sub f1()
8 Console.WriteLine("Class C1: {0} {1}", a1, a2)
9 End Sub
10 End Class
12 Sub Main()
13 Dim a As New C1()
14 With a
15 .a2 = "Hello World"
16 GoTo labelA
17 ' Exit before all statements in With have been executed
18 .a1 = 20
19 Dim x As New C1()
20 a = x
21 If .a1 = a.a1 Or .a2 = a.a2 Then
22 Throw New Exception("#WS1 - With Statement failed")
23 End If
24 a.f1()
25 .f1()
26 labelA:
27 End With
28 If a.a1 = 20 Then
29 Throw New Exception("#WS2- Exit from With Statement failed")
30 End If
31 End Sub
33 End Module