FWIW - I had a method that looked like this
The important part is that it won't allow the method to collapse with one Optional argument.Code:Public Sub WontCollapse(Optional para As String = "")
End Sub
Printable View
FWIW - I had a method that looked like this
The important part is that it won't allow the method to collapse with one Optional argument.Code:Public Sub WontCollapse(Optional para As String = "")
End Sub
Confirmed on my end, that's not only odd it does that but also odd that I haven't noticed. Typically I won't setup optional parameters though, I tend to create multiple methods with different signatures. E.g. in your situation:
Code:Public Sub Foo()
Sub("")
End Sub
Public Sub Foo(para As String)
' do something
End Sub
Same here, for the last decade plus. At some point I read that optional parameters were discouraged, though I forget why. It shouldn't be performance, as the compiler could quietly turn an optional parameter into two different methods...and that may be what it does anyways.