https://bugzilla.novell.com/show_bug.cgi?id=691661
https://bugzilla.novell.com/show_bug.cgi?id=691661#c0 Summary: Cannot cast from dynamic to generic in Mono C# 4.0 Classification: Mono Product: Mono: Compilers Version: 2.10.x Platform: Macintosh OS/Version: Mac OS X 10.6 Status: NEW Severity: Normal Priority: P5 - None Component: C# AssignedTo: msa...@novell.com ReportedBy: m...@markrendle.net QAContact: mono-bugs@lists.ximian.com Found By: Community User Blocker: No Description of Problem: In MS C# 4, this method compiles fine: public IEnumerable<T> OfType<T>() { // Source is an IEnumerable<dynamic> foreach (var item in _sourceEnumerator.Current) { bool success = true; T cast; try { cast = (T)item; } catch (RuntimeBinderException) { cast = default(T); success = false; } if (success) { yield return cast; } } } In Mono 2.10.x, targeting .NET 4, the C# compiler gives an error on the (T)item cast, "Unable to cast...". If I change that line to (T)(object)item, it works. How often does this happen? All the time. Additional Information: -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. _______________________________________________ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs