**** Merged from MCS ****
[mono-project.git] / mcs / btests / Optional_ParamArrayC1.vb
blobbccb9f93422f7bfe6d715d0a537c811f25a45a8a
1 REM LineNo: 15
2 REM ExpectedError: BC30642
3 REM ErrorMessage: 'Optional' and 'ParamArray' cannot be combined.
5 '============================================================================================
6 'Name:Manish Kumar Sinha
7 'Email Address: manishkumarsinha@sify.com
8 'Test Case Name: ParamArray:
9 'APR-1.0.0: ParamArray can be used only on the last argument of argument list. it allows us to 'pass an arbitrary list. It allows us to pass an arbitrary number of argument to the procedure
10 '=============================================================================================
12 Option Strict Off
13 Imports System
14 Module PA_1_0_0
15 Sub F(Optional ParamArray args() As Integer = {0,0,0})
16 Console.Write("Array contains " & args.Length & " elements:")
17 if (args.Length <> 3)
18 Throw New System.Exception("#A1, Unexcepted behaviour in string of OP1_0_1")
19 end if
20 End Sub
21 Sub Main()
22 Dim a As Integer() = { 1, 2, 3 }
23 F(a)
24 F(10, 20, 30)
26 End Sub
27 End Module
28 '=============================================================================================