**** Merged from MCS ****
[mono-project.git] / mcs / btests / OptionalArgFunction1.vb
blob6a7885e74312978bfa09826cf10b8f6b96e195af
1 '=============================================================================================
2 'Name:Manish Kumar Sinha
3 'Email Address: manishkumarsinha@sify.com
4 'Test Case Name: Argument passing by Optional Keyword:
5 'O.P-1.0.0: An Optional parameter must specify a constant expression to be used a replacement
6 ' value if no argument is specified.When we omit one or more optional arguments in
7 ' the argument list, you use successive commas to mark their positions.
8 ' If we don't mark commas then it produce run time error
9 '=============================================================================================
11 Imports System
12 Module OP1_0_0
13 Function F(ByVal telephoneNo as Long, Optional ByVal code as Integer = 080,Optional ByVal code1 As Integer = 091, Optional ByRef name As String="Sinha") As Boolean
14 if (code = 080 and code1 = 091 and name="Manish")
15 return true
16 else
17 return false
18 end if
20 End Function
22 Sub Main()
23 Dim telephoneNo As Long = 9886066432
24 Dim name As String ="Manish"
25 Dim status As Boolean
26 status =F(telephoneNo,name)
27 if (status = false)
28 Throw New System.Exception("#A1, Unexcepted behaviour in string of OP1_0_0")
29 end if
30 End Sub
32 End Module