3

What is the proper syntax for declaring an option parameter of type String(); means how do I assign it a default value of empty array (not Nothing):

Function SomeFunc(id as Integer, name as String, Optional values() As String = ???)

I tried with {} but it doesn't accept that, saying "A constant expression is required", which also means it won't accept anything like New String().

dotNET
  • 33,414
  • 24
  • 162
  • 251
  • [Passing an empty array as default value of an optional parameter](http://stackoverflow.com/questions/3480382/passing-an-empty-array-as-default-value-of-an-optional-parameter) – har07 Apr 30 '14 at 13:34

1 Answers1

4

hi You can Try This..

function example(optional ByVal arr1() as System.Array = nothing)
user1102001
  • 689
  • 2
  • 10
  • 21
  • Thanks but you probably missed that I want to assign it an empty array, not `Nothing`. – dotNET Apr 30 '14 at 12:48
  • I figured out that this is currently not possible to do what I want. Passing `Nothing` is my only option here, so I'll mark this as answer. – dotNET May 02 '14 at 18:52