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

David Mitchell dmitchell at logos.com
Thu Jul 15 09:24:28 EDT 2010


It seems that it's been fixed on a more recent revision. Apologies

-- Dave (on the iPhone)

On Jul 15, 2010, at 3:55 AM, "Atsushi Eno" <atsushieno at veritas-vos-liberabit.com> wrote:

> 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