I hate this behavior, and I believe it was introduced around c# 3

On Wednesday, January 5, 2011, Eric Slosser <[email protected]> wrote:
> <csharp newbie>
>
> I have a C# struct that's defined as
>
>         public struct Field : IComparable, IComparable<Field>, 
> IEquatable<Field>
>         {
>         }
>
> When I do this:
>
>         Field f = null;
>
> I'd expect error CS0037 (can't convert null to 'Field' because it is a value 
> type.
>
> But when Field is defined in an assembly that was compiled by VisStudio, gmcs 
> (v2.8.1.0) is happy to let me assign null to it.
>
> Why?
>
>
> _______________________________________________
> Mono-list maillist  -  [email protected]
> http://lists.ximian.com/mailman/listinfo/mono-list
>
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to