[Mono-bugs] [Bug 566130] linq statement is crazy, but it is valid

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Dec 21 14:11:12 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=566130

http://bugzilla.novell.com/show_bug.cgi?id=566130#c2


--- Comment #2 from Jay Wren <jrwren at xmtp.net> 2009-12-21 19:11:11 UTC ---
Here is a complete program which recreates the problem:

using System;
using System.Linq;
using System.Xml;
using System.Xml.Linq;

namespace kaboom
{
    class MainClass
    {
        public static void Main (string[] args)
        {

            DateTime junk;
            var results =  (from item in
XDocument.Load("codemash.rss").Descendants("item")
                    let updated = 
                            new
System.Text.StringBuilder(item.Element("updated").Value).Replace('T','
',10,1).Replace('-',' ',19,1)
                    let parsed = DateTime.TryParse(updated.ToString(), out
junk)
                select new RssItem { 
                    title=item.Element("title").Value,
                    link=item.Element("link").Value,
                    description = item.Element("description").Value,
                    updated = parsed? junk : DateTime.Now,
            }).ToList();
        }

        class RssItem { public string title,link,description; public DateTime
updated ; }
    }
}

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list