I'm a little bit confused by the explanations of linq online so I figured I'd make a thread.
I want to replace my foreach statements with linq statements as I'm sure doing little things like this will make me program better.
Example of what I'd like to use LINQ with:
public bool CheckForAccount(int accountID)
{
bool status = false;
foreach (AccountHolders accountHolder in AccountHoldersList)
{
if (accountHolder.AccountNumber == accountID)
{
status = true;
break;
}
}
return status;
}
Please can you provide an explanation of how it works too so I understand what you're doing.
Thanks in advance!