[Mono-dev] explicit conversion to bool and bool? on XElement

Atsushi Eno atsushieno at veritas-vos-liberabit.com
Thu Jul 15 06:55:25 EDT 2010


Hello,

I don't see such a problem.

--------
$ cat x.cs
using System;
using System.Xml.Linq;

public class Test
{
         public static void Main ()
         {
                 XName n = XName.Get ("x");
                 Console.WriteLine ((bool?) new XElement (n, "true"));
                 Console.WriteLine ((bool?) new XElement (n, "True"));
                 Console.WriteLine ((bool?) new XElement (n, "false"));
                 Console.WriteLine ((bool?) new XElement (n, "False"));
         }
}

$ gmcs x.cs -r:System.Xml.Linq.dll

$ ./x.exe
True
True
False
False

$ mono ./x.exe
True
True
False
False
--------

Atsushi Eno

On 2010/07/15 5:53, David Mitchell wrote:
> Currently (or at least as of revision 147679), the explicit conversion to bool for XElement calls System.Xml.XmlConvert.ToBoolean(), which is case sensitive. However, Microsoft's implementation of the explicit conversion is case insensitive.
>
> Attached is a patch that corrects this issue by converting the convent of the XElement to lower case before sending it to XmlConvert.ToBoolean().
>
> I would very much appreciate it if someone would review/apply this patch (or fix the issue in some other way).
>
> Thanks!
> -- Dave
>
>   
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>    



More information about the Mono-devel-list mailing list