Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. 'A simple 1-dimensional array [notice the '()' too]
  2. Dim arrayOfNumbers() As Integer = {1, 2, 3, 4, 5}
  3.  
  4. 'Declaring a list on one line through adding an array instead of adding items later
  5. Dim controlList As New List(Of Control)({myTextBox, myComboBox, myLinkLabel})
  6.  
  7. 'Creating an array 'on the fly' for a loop or another reason
  8. For Each control As Control In {myTextBox, myComboBox, myLinkLabel}
  9. control.Enabled = True
  10. Next
  11.  
  12. Dim A As Boolean = True
  13. Dim B As Boolean = False
  14.  
  15. If A AndAlso B Then 'A and B will be evaluated
  16. If A OrElse B Then 'OrElse will shortcircuit since whatever B returns will not change the outcome of this validation
  17. If B AndAlso A Then 'AndAlso will shortcircuit
  18. If B OrElse A Then 'B and A will be evaluated
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement