单声道开发 2.4.1 +链接错误
我刚刚开始学习Mono Develop
安装了Mono Develop 2.4.1 和Mono Touch 的试用版。
我的代码:
using System;
using System.Xml.Linq;
using System.Collections.Generic;
namespace RSSReader
{
public static class RSSRepository
{
public static IList<FeedItem> GetFeeds(string url)
{
XDocument rssFeed = XDocument.Load(url);
Console.Write(rssFeed.ToString());
var feeds = new List<FeedItem>();
try {
var query = from item in rssFeed.Descendants("item")
select new FeedItem
{
Title = item.Element("title").Value,
Published = DateTime.Parse(item.Element("pubDate").Value),
Url = item.Element("link").Value
};
feeds = query.ToList();
}
catch (Exception ex){
Console.WriteLine(ex.Message);
}
return feeds;
}
}
}
这引发错误:找不到“选择”查询表达式模式的实现。您是否缺少“System.linq”使用指令或“System.Core.dll”程序集引用?
我得到了对 System.Xml.Linq 和 System.Core 的引用,
我缺少什么?
I just started to learn Mono Develop
Installed Mono Develop 2.4.1 and trial version of Mono Touch.
my Code:
using System;
using System.Xml.Linq;
using System.Collections.Generic;
namespace RSSReader
{
public static class RSSRepository
{
public static IList<FeedItem> GetFeeds(string url)
{
XDocument rssFeed = XDocument.Load(url);
Console.Write(rssFeed.ToString());
var feeds = new List<FeedItem>();
try {
var query = from item in rssFeed.Descendants("item")
select new FeedItem
{
Title = item.Element("title").Value,
Published = DateTime.Parse(item.Element("pubDate").Value),
Url = item.Element("link").Value
};
feeds = query.ToList();
}
catch (Exception ex){
Console.WriteLine(ex.Message);
}
return feeds;
}
}
}
This is throwing an error: An implementation of 'select' query expression pattern could not be found. Are you missing 'System.linq' using directive or 'System.Core.dll' assembly reference?
I got both references to System.Xml.Linq and System.Core
What am i missing ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如编译器所说,您“缺少 'System.linq' using 指令”。
As the compiler says, you are "missing 'System.linq' using directive".