I sampled some code from a post around here. I am trying to read a .txt file with LINQ and make the query confirm that a username is indeed inside of it (with an if statement), and then proceed to another if statement that will check if the password is existing, and then extract that information.
The .txt file is formatted like this
<Site> ||<Email/User> ||<Password>
Google | UserNameOk123 | Password12312
Facebook | overlordvader@msn.com | 832188981323
Gmail | coolkids22@gmail.com | password1
Yahoo (lol) | manualentry1@yahoo.com | shtein998877
Reddit | wildsavage2 | 88ca$
reddit.com | patrickthestar | krustykrabs22
iCloud | asdasd@me.com | gigihadid8$
How do I properly work around this code: (doesn't compile)
public void ScanFile( string input)
{
string[] AllLines = new string[];
AllLines = File.ReadAllLines(FILE_PATH);
Parallel.For(0, AllLines.Length, x =>
{
if (from lines in AllLines
where lines.StartsWith("firstHalfOfUsername")
&& lines.EndsWith("secondHalfOfUsername")
select line)
{
}
});
}