foreach (string line in File.ReadLines("Sample.txt"))
{
if (line.EndsWith("<\a>"))
Console.WriteLine(line);
}
or
foreach (string line in File.ReadLines("Sample.txt").Where(line => line.EndsWith("<\a>")))
{
Console.WriteLine(line);
}
or (a bit forced):
File.ReadLines("Sample.txt").Where(line => line.EndsWith("<\a>")).All(l => { Console.WriteLine(l); return true; });
But the inclusion test could be more sophisticated depending on how in-exactly the
<\a>
must be matched.