nullable ref parameters #9602
Unanswered
cjsio
asked this question in
Language Ideas
Replies: 1 comment 5 replies
-
Duplicate of #8156. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This is midpoint between language idea and question for historical leadup into not having nullable byref parameters. Back in vb.net we had exactly this, like:
Public Function AcquireLocationID(ByRef context As HttpContext, Optional ByRef activeProfile As Profile = Nothing) As Integer
Or for my today's instance, in vb would originally look like:
Public Function ProcessDebugKeybinds(ByRef kMod As KeyModifier = Nothing) As KeyModifier
but to achieve the same effect QoL (of omitting a parameter, but still getting the
ref
value back when the parameter is supplied) requires a function overload parameterless definition, instead of the cleanest and least redundant source solution of just:void ProcessDebugKeybinds(ref KeyModifier kMod = null) {
Comparison in-vs:
Thanks for your time
Beta Was this translation helpful? Give feedback.
All reactions