The language is C# 3.0 with implicitly typed local variable and LINQ query operations support.
The problem is that, since Object.Equals isn't overriden in your FileInfo instances, your comparison is using normal reference type equality semantics. The comparison instances aren't the same object, so the comparison returns false.
Here's is a little custom equality comparer that will allow you to compare you FileInfo object's Name property:
public class FileNameComparer : EqualityComparer<FileInfo>
public override bool Equals(FileInfo x, FileInfo y)
return x.Name == y.Name;
public override int GetHashCode(FileInfo obj)
Now in your code, instantiate a FileNameComparer, then use the Enumerable.Contains<TSource> overload that accepts two parameters: an IEnumerable<TSource>, and a IEqualityComparer<TSource>, like:
FileInfo fileName = Qry.ToArray<FileInfo>();
FileNameComparer fileNameComparer = new FileNameComparer();
if (fileName.Contains<FileInfo>(RowTextFile, fileNameComparer))