[Mono-bugs] [Bug 359733] Generic Extension methods with constraints on the generic type don' t compile
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sun Feb 10 10:50:53 EST 2008
https://bugzilla.novell.com/show_bug.cgi?id=359733
User atsushi at ximian.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=359733#c5
--- Comment #5 from Atsushi Enomoto <atsushi at ximian.com> 2008-02-10 08:50:53 MST ---
I've cooked a similar test case, which actually compiled fine. So it does not
happen when the extension type is in the same assembly (i.e. likely reference
resolution issue).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
public class Test
{
public static void Main ()
{
XDocument doc = XDocument.Parse
("<root><foo/><bar/><baz/></root>");
// replace it with Remove<XNode>() and it will fail.
doc.Root.Nodes ().Hooray<XNode> ();
}
}
public static class MyExtensions
{
public static void Hooray<T> (this IEnumerable<T> source) where T :
XNode
{
foreach (T item in source)
item.Remove ();
}
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list