Skip to content

Instantly share code, notes, and snippets.

@klmr
Last active December 14, 2015 01:08
Show Gist options
  • Save klmr/5003412 to your computer and use it in GitHub Desktop.
Save klmr/5003412 to your computer and use it in GitHub Desktop.
A note on line-breaks and indentation in VB to maximise readability:
' Single-line lambdas:
_myService.MyMethod(userId, profileId,
Sub(message As EventArgs) _eventAggregator.SendMessage(message))
' Multi-line lambdas: align `Sub` and `End Sub`:
_myService.MyMethod(userId, profileId, Sub(message As EventArgs)
_eventAggregator.SendMessage(message)
_localVariable = e.Result
End Sub)
' … the IDE should do this automatically for you.
' Of course, this is quite a huge level of indentation, you can dedent the whole block:
_myService.MyMethod(userId, profileId,
Sub(message As EventArgs)
_eventAggregator.SendMessage(message)
_localVariable = e.Result
End Sub)
' (note the alignment to the opening parenthesis of the surrounding parameter list)
' … or even:
_myService.MyMethod(userId, profileId,
Sub(message As EventArgs)
_eventAggregator.SendMessage(message)
_localVariable = e.Result
End Sub)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment