单声道开发 2.4.1 +链接错误

发布于 2024-10-10 09:26:44 字数 1129 浏览 0 评论 0原文

我刚刚开始学习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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吃颗糖壮壮胆 2024-10-17 09:26:44

正如编译器所说,您“缺少 'System.linq' using 指令”。

using System.Linq;

As the compiler says, you are "missing 'System.linq' using directive".

using System.Linq;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文