|
-
Jul 3rd, 2024, 12:58 PM
#1
Oddity
FWIW - I had a method that looked like this
Code:
Public Sub WontCollapse(Optional para As String = "")
End Sub
The important part is that it won't allow the method to collapse with one Optional argument.
-
Jul 3rd, 2024, 04:52 PM
#2
Re: Oddity
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
-
Jul 3rd, 2024, 08:06 PM
#3
Re: Oddity
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.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|