Using VB.NET, I'm trying to clean up a code base following ReSharper's guidelines. I currently have the following code:
'oSearchInput is defined outside this question
Dim oSearchRoutines As New SearchClient
Dim oSearchResults As List(Of SearchResult)
oSearchRoutines = 'WcfCallThatReturnsSearchClient
oSearchResults = oSearchRoutines.getSearchResults(oSearchInput).ToList
Now this works completely fine, but ReSharper warns that As New SearchClient
has 'Value assigned is not used in any execution path'. So I removed that part to get this code:
'oSearchInput is defined outside this question
Dim oSearchRoutines
Dim oSearchResults As List(Of SearchResult)
oSearchRoutines = 'WcfCallThatReturnsSearchClient
oSearchResults = oSearchRoutines.getSearchResults(oSearchInput).ToList
If I'm understanding this correctly, everything should work exactly the same. However, an error is thrown when calling ToList
:
Public member 'ToList' on type 'SearchResult()' not found.
I'm not exactly sure why there's any difference between the two snippets I have here.