Needing some help with this

Solarion

Honorary Master
Joined
Nov 14, 2012
Messages
21,885
Needing some help with this please guys

I'm busy trying to fix up this project I am working on, however my understanding of LINQ is severely lacking. Could someone please give me a clue as to what should go here, because the bold bit is getting flagged with an error. I'm not sure what should go there.

Code:
Dim ListToProcess = Directory.GetFiles(serverPath & "\Documents\Notes", "*", SearchOption.AllDirectories).Where(Function(x) [B]dataForWord[/B].Select(Function(y) y(12)).Contains(x.Split("\").Last().Split(".").First.Split(" ").Last))

'dataForWord' is not declared. It may be inaccessible due to its protection level.

I suspect this dataForWord is perhaps a book mark or placeholder put in by someone else.

Any help will be appreciated!
 
Last edited:

animal531

Expert Member
Joined
Nov 12, 2013
Messages
2,728
I unfortunately don't know much about vb syntax, so I can help there, but if I were you I'd just unroll the stack into standard code.
 

Solarion

Honorary Master
Joined
Nov 14, 2012
Messages
21,885
I think what this guy was trying to do was strip away the file path and extension and just get the filename.

Seems like an awfully painful way of doing it :erm:
 

MielieSpoor

Expert Member
Joined
Dec 6, 2006
Messages
1,984
'dataForWord' is not declared in the context in which this linq query runs.

Also, make the code more readable by having your '.' methods on it's own line with the correct indentation. I think you can do that with VB.Net also.

But back to the issue though. dataForWord is a list or something that should be declared either in your method or class and it's not there.
 
Top