I've used IComparer before but I seem to be getting an odd issue where I'm not getting the second argument to my Comparer function.
internal class FreePtrCompare : IComparer<File>
{
int IComparer<File>.Compare(File x, File y)
{
int a = x.fsPos; //Free space pointer of file 1
int b = y.fsPos; //Free space pointer of file 2
return a.CompareTo(b);
}
}
File [] takenSpace = HardDrive; //HardDrive is also a Array of Files
Array.Sort(takenSpace, new FreePtrCompare());
Basically as soon as it gets to the "Array.Sort" line it crashes where "int b" is declared in the "FreePtrCompare" class saying that File y is null object/pointer reference. which it is, but I'm not entirely sure why that isn't being passed through correctly.
Has anyone else run into this issue before?