[Mono-list] Differing nullable behavior

Steve Deobald steve at deobald.ca
Fri Aug 4 13:41:39 EDT 2006


Nullables are value types. It seems the .Microsoft NET Framework
permits this as an exceptional case for usages of the 'as' keyword
with Nullable<T> on the right. It would seem Mono should do the same
if it currently does not.

-Steve

On 8/4/06, Pedro Sobota <pedro at sobota.net> wrote:
> Hi,
>
> It seems in Mono, nullables are seen as value types, like the values
> they contain. This is different from the .Net Framework, for example,
> this code compiles and works on .Net, but not on Mono:
>
> using System;
>
> class Global {
>     static void Main() {
>         Console.Write(2 as int?);
>     }
> }
>
> On Mono the result is error CS0077: The as operator must be used with a
> reference type ('int?' is a value type).
>
> Is this intended, or a bug?
>
> Pedro
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>


More information about the Mono-list mailing list