Hi, I am currently using CSLA 3.5.
I have inherited SortedBindingList and added a new method as following:
private int FindLike(PropertyDescriptor property, object key, bool ignoreCase)
{
try
{
var item = this.First(a => String.Compare(property.GetValue(a).ToString(), key.ToString(), ignoreCase) >= 0);
int i = this.IndexOf(item);
System.Diagnostics.Debug.Print(i.ToString());
return i;// this.IndexOf(item);
}
catch
{
System.Diagnostics.Debug.Print("none");
return -1;
}
}
I bind the list to the winform datagridview, I found the when the target column is sorted ascending (automatic mode), the new FindLike method is working properly, however, when the target column is sorted descending, the linq First method always return me the first item, eventhose it is not match. Is it something wrong with my code or I have miss anything ?
Thanks in advance.
Jason Law
Copyright (c) Marimer LLC