[MonoTouch] EqualityComparer<T>.Default used by System.Collections.Generic.List.Remove(), how to workaround?
Jonathan Pryor
jonpryor at vt.edu
Fri Oct 9 09:35:08 EDT 2009
On Thu, 2009-10-08 at 23:41 -0700, Ed Anuff wrote:
> I've found that the List.Remove() method uses
> EqualityComparer<T>.Default, which of course, fails with "Attempting
> to JIT compile method". I don't see a way to provide my own
> EqualityComperer to avoid this. Is there a simple workaround?
Use List<T>.RemoveAt(int) and List<T>.FindIndex(Predicate<T>):
yourList.RemoveAt(
yourList.FindIndex(x => x == 42));
Otherwise, if T is a builtin type (int, long, char, etc.) or a reference
type (string, etc.) then List<T>.Remove() should work normally for
MonoTouch >= 1.1.
- Jon
More information about the MonoTouch
mailing list