[Mono-dev] Mono 2.8 regression

Tom Spink tspink at gmail.com
Mon Dec 20 18:08:50 EST 2010


It should run fine, as it's /probably/ doing what the cast to object
is doing... But, of course, it violates type-safety so the compiler
moans at you.

Like I suggested, if you cast to object, then cast to the delegate,
this'll get round the compilation error.

-- Spink

On 20 December 2010 11:09, Federico Di Gregorio <fog at initd.org> wrote:
> On 20/12/2010 11:11, Tom Spink wrote:
>> You could propagate the abstract method type parameter out to the
>> class definition:
>
> Unfortunately I can't have a generic abstract class because I need:
>
> Dictionary<Type,A> precompiledExpressionsByType;
>
> and then, in other parts of the library:
>
> X result = precompiledExpressionsByType[typeof(X)]
>        .evaluateSuchAndSuchExpr<X>(param1, param2, ...);
>
> where evaluateSuchAndSuchExpr() is a method of A (GetXXX in my previous
> email).
>
> Anyway, thank you all for confirming this was a bug in my code[*]; I'll
> fix it using a different approach.
>
> federico
>
> [*] In fact the code runs fine, even on MS.NET, when compiled with Mono 2.6.
>
> --
> Federico Di Gregorio                                       fog at initd.org
>  Ubuntu is an ancient African word meaning "I can't configure Debian".
>                                                     -- somewhere on IRC
>



-- 
Tom Spink


More information about the Mono-devel-list mailing list