2005-03-23 Ritvik Mayank <mritvik@novell.com>
[mono.git] / mcs / mbas / Test / tests / WithStatementB.vb
1 Imports System
2
3
4 Module WithStatementB
5     Class C1
6         Public a1 As Integer = 10
7         Friend a2 As String = "Hello"
8         Sub f1()
9             Console.WriteLine("Class C1: {0} {1}", a1, a2)
10         End Sub
11     End Class
12
13     Sub main()
14         Dim a As New C1()
15         With a
16             a.a1 = 20
17             .a2 = "Hello World"
18             Dim x As New C1()
19             a = x  ' Tried reassiging the object inside With statement
20             If .a1 = a.a1 Or .a2 = a.a2 Then
21                 Throw New Exception("#WS1 - With Statement failed")
22             End If
23             a.f1()
24             .f1()
25         End With
26
27     End Sub
28
29 End Module