**** Merged from MCS ****
[mono-project.git] / mcs / btests / Optional_ParamArrayC2.vb
blobd7f732d0c98a51a47911bdf8a336ef86112ce4f3
1 REM LineNo: 31
2 REM ExpectedError: BC30046
3 REM ErrorMessage: Method cannot have both a ParamArray and Optional parameters.
5 REM LineNo: 32
6 REM ExpectedError: BC30451
7 REM ErrorMessage: Name 'args' is not declared.
9 REM LineNo: 33
10 REM ExpectedError: BC30451
11 REM ErrorMessage: Name 'args' is not declared.
13 REM LineNo: 39
14 REM ExpectedError: BC30311
15 REM ErrorMessage: Value of type '1-dimensional array of Integer' cannot be converted to 'Integer'.
17 REM LineNo: 40
18 REM ExpectedError: BC30057
19 REM ErrorMessage: Too many arguments to 'Public Sub F([length As Integer = 3])'.
21 '============================================================================================
22 'Name:Manish Kumar Sinha
23 'Email Address: manishkumarsinha@sify.com
24 'Test Case Name: Optional argument:
25 'APR-1.0.0: ParamArray and Optional can be used together
26 '=============================================================================================
28 Option Strict Off
29 Imports System
30 Module PA_1_0_0
31 Sub F(Optional ByVal length as Integer = 3 , ParamArray args() As Integer )
32 Console.Write("Array contains " & args.Length & " elements:")
33 if (args.Length <> length)
34 Throw New System.Exception("#A1, Unexcepted behaviour in string of OP1_0_1")
35 end if
36 End Sub
37 Sub Main()
38 Dim a As Integer() = { 1, 2, 3 }
39 F(a)
40 F(10, 20, 30)
42 End Sub
43 End Module
44 '=============================================================================================