Windows Phone アプリを Win 8 に移植していますが、この障害を見つけましたが、解決策が見つかりません。
私は持っています:
List<items> tempItems = new List<items>();
と
ObservableCollection<items> chemists = new ObservableCollection<items>();
tempItems などにアイテムを追加したので、次のようにします。
tempItems.OrderBy(i => i.Distance)
.Take(20)
.ToList()
.ForEach(z => chemists.Add(z));
しかし、私はこのエラーが発生します:
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?)
Win8にはこの機能がないのはなぜですか?以下を参考にしています。
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;
ForEach が利用できない場合、同じことを行う代替手段はありますか?