Can someone help me to find the equivalent Linq expressions?
-
Hello All, Array.FindAll, Array.Find and List.RemoveAll() are not available in Silverlight. I'm looking for the equivalent Linq expressions of those methods. I'm also finding the equivalent one but it would be great if you guys can share if you already have something. thanks in advance..
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
-
Hello All, Array.FindAll, Array.Find and List.RemoveAll() are not available in Silverlight. I'm looking for the equivalent Linq expressions of those methods. I'm also finding the equivalent one but it would be great if you guys can share if you already have something. thanks in advance..
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
I think it will work. public static class ArrayHelper { public static T Find(T[] array, Predicate match) { foreach (var o in array) { if (match(o)) { return o; } } return default(T); } public static T[] FindAll(T[] array, Predicate match) { List list = new List(); foreach (var o in array) { if (match(o)) { list.Add(o); } } return list.ToArray(); } }
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)