Is function IndexOf in DataItemCollecion using Equals method on objects?
1 Answer, 1 is accepted
0
Nedyalko Nikolov
Telerik team
answered on 20 Sep 2011, 11:49 AM
Hello Mariusz,
Generally DataItemCollection.IndexOf(item) works as IList.IndexOf() method, which in fact uses BO.Equals method. Due to some optimization when RadGridView is sorted DataItemCollection.IndexOf(item) uses Dictionary.TryGetValue method which also relies on BO.GetHashCode() method. By the way according to this msdn article you should also override GetHashCode(), so in any case IndexOf() will work correctly.
Let me know if this doesn't help.
Best wishes,
Nedyalko Nikolov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>