Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. Replace the following code with Linq syntax
  2.  
  3. For i = 0 the list.count - 1
  4. If list(i) = "0" Then
  5. list.RemoveAt(j)
  6. End If
  7. Next
  8.  
  9. Method 1
  10.  
  11. list = list.Where(function(value) value <> "0").ToList
  12.  
  13. Method 2
  14.  
  15. list.RemoveAll(Function(o) o="0")
  16.  
  17. Method 3
  18.  
  19. List.RemoveAll(AddressOf TestFunction)
  20.  
  21. Public Function TestFunction(ByVal item As String) As Boolean
  22. return item = "0"
  23. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement