Lista <> .ForEach no encontrado [duplicado]
Esta pregunta ya tiene una respuesta aquí:
¿Ha desaparecido el método List <T> .ForEach ()? 3 respuestasEstoy portando una aplicación de Windows Phone a Win 8, y he encontrado este obstáculo, pero no puedo encontrar la solución.
Tengo un:
List<items> tempItems = new List<items>();
y
ObservableCollection<items> chemists = new ObservableCollection<items>();
He añadido elementos a mis tempItems, etc., entonces hago esto:
tempItems.OrderBy(i => i.Distance)
.Take(20)
.ToList()
.ForEach(z => chemists.Add(z));
Pero me sale este error:
Error 1 'System.Collections.Generic.List<MyApp.items>' does not contain a definition for 'ForEach' and no extension method 'ForEach' accepting a first argument of type 'System.Collections.Generic.List<MyApp.items>' could be found (are you missing a using directive or an assembly reference?)
¿Por qué podría ser eso, Win8 no tiene esta función? Estoy haciendo referencia a lo siguiente:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Xml.Linq;
using Windows.Devices.Geolocation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
using Windows.UI.Xaml.Navigation;
using System.Collections.ObjectModel;
Si ForEach no está disponible, ¿hay alguna alternativa que haga lo mismo?