[Mono-list] Generics sharing vs delegates?

Chris Howie cdhowie at gmail.com
Mon Aug 4 08:41:28 EDT 2008


On Mon, Aug 4, 2008 at 4:21 AM, Mike Cleaver <mike at moga.to> wrote:
> After a few seconds thought I realised that this is easier:
>
> public static T [] GetDirectives<T>(IEnumerable<AbstractDirective>
> directives) where T : AbstractDirective {
>                        List<T> output = new List<T>();
>                        foreach(AbstractDirective directive in directives) {
>                                if(directive is T) output.Add(directive as T);
>                        }
>                        return output.ToArray();
>                }
>
> My app runs fine now as this was the only problem running 2.0p,
> strange that it occurs at all though?

Indeed.  I would file a bug report with a test case.  This behavior
does not seem at all desirable.

-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers


More information about the Mono-list mailing list