source: 2013/30/MiskaK/MW2(My Warfare 2)/Paranneltu Jypeli/Physics2DDotNet/ListExtension.cs @ 4507

Revision 4507, 893 bytes checked in by anlakane, 7 years ago (diff)

Talletus.

RevLine 
[4507]1#if WINDOWS_PHONE || XBOX
2
3using System;
4using System.Collections.Generic;
5using System.Linq;
6using System.Text;
7
8namespace Physics2DDotNet
9{
10    /// <summary>
11    /// In Windows Phone, the generic list has no RemoveAll method,
12    /// which is widely used in the physics library. This
13    /// class adds the missing method to the List class.
14    /// </summary>
15    internal static class ListExtension
16    {
17        public static int RemoveAll<T>(this List<T> list, Predicate<T> match)
18        {
19            int count = 0;
20            int i = 0;
21
22            while (i < list.Count)
23            {
24                if (match(list[i]))
25                {
26                    list.RemoveAt(i);
27                    count++;
28                    continue;
29                }
30
31                i++;
32            }
33
34            return count;
35        }
36    }
37}
38
39#endif
Note: See TracBrowser for help on using the repository browser.