C# 在Visual Studio 2015中引用Windows Phone 8.1中的程序集

C# 在Visual Studio 2015中引用Windows Phone 8.1中的程序集,c#,windows-phone-8.1,visual-studio-2015,C#,Windows Phone 8.1,Visual Studio 2015,在Visual Studio 2015下的Windows Phone 8.1项目中,对于Linq、ObservableCollection等,我需要参考什么 我得到了这个错误,但只在手表窗口中: 组错误CS0012:在未引用的程序集中定义了类型“IGrouping”。您必须添加对程序集“System.Linq,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”的引用 但此程序集不是为Windows通用应用程序构建的。那

在Visual Studio 2015下的Windows Phone 8.1项目中,对于Linq、ObservableCollection等,我需要参考什么

我得到了这个错误,但只在手表窗口中

组错误CS0012:在未引用的程序集中定义了类型“IGrouping”。您必须添加对程序集“System.Linq,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”的引用

但此程序集不是为Windows通用应用程序构建的。那么我应该引用什么程序集包呢?可观察收集也是如此

使用系统;
使用System.Collections.Generic;
使用System.Collections.ObjectModel;
使用System.Linq;
使用系统文本;
使用System.Threading.Tasks;
使用Windows.UI;
命名空间GoodCode.GTDApp.Models
{
公共类页面模型
{
公共ObservableCollection项{get;set;}
公共页面模型()
{
this.Items=新的ObservableCollection();
this.Items.CollectionChanged+=Items\u CollectionChanged;
}
私有无效项\u CollectionChanged(对象发送方,System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
var groups=this.Items.GroupBy(s=>s.Date);
foreach(组中的var组。OrderByDescending(s=>s.First().Date))
{
foreach(组中的var项目)
{
item.Color=Colors.Red;
}
}
}
}
}

您能在使用分组的地方添加代码吗?我已经在我的wp8.1项目上试用过了,它很管用。好吧,奇怪的是,它正在工作,但这个错误只是在观察窗口中抛出的。查看编辑。对此有任何解决方案吗?
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI;

namespace GoodCode.GTDApp.Models
{
    public class PageModel
    {
        public ObservableCollection<ItemModel> Items { get; set; }

        public PageModel()
        {
            this.Items = new ObservableCollection<ItemModel>();
            this.Items.CollectionChanged += Items_CollectionChanged;
        }

        private void Items_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            var groups = this.Items.GroupBy(s => s.Date);
            foreach (var group in groups.OrderByDescending(s => s.First().Date))
            {
                foreach (var item in group)
                {
                    item.Color = Colors.Red;
                }
            }
        }
    }
}