Skip to content

Instantly share code, notes, and snippets.

@emoacht
Last active August 29, 2015 14:17
Show Gist options
  • Save emoacht/336edbd7550deece18b3 to your computer and use it in GitHub Desktop.
Save emoacht/336edbd7550deece18b3 to your computer and use it in GitHub Desktop.
Possible Resharper's bug
Public Sub TestResharper1()
Dim source As String = "0123456789"
Dim lengths = New Integer() {4}.ToList()
lengths.ForEach(
Sub(x)
source = source.Substring(0, x) 'Resharper warning: Value assigned is not used in any execution path
End Sub)
Debug.WriteLine(source) '0123
End Sub
Public Sub TestResharper2()
Dim source As String = "0123456789"
Dim lengths = New Integer() {4}.ToList()
lengths.ForEach(
Sub(x) source = source.Substring(0, x)) 'No Resharper warning
Debug.WriteLine(source) '0123
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment