FileInfo Doesn't Override Equals

So if you write code like this:

FileInfo f1 = new FileInfo(@"C:\File1.txt");
FileInfo f2 = new FileInfo(@"C:\File1.txt");

bool areEqual = f1 == f2;

areEqual will be false. At least that's what I saw today.

Mrph.

Oh well, this "fixes" it (at least it makes sense to me!):

bool areEqual = f1.FullName == f2.FullName;

* Posted at 02.25.2008 04:02:27 PM CST | Link *

Blog History