[Mono-dev] Unexpected compiler errors when using "as" keyword

Max de Lavenne max at tfbc.com
Wed Aug 13 15:08:34 EDT 2008


Yeah, and maybe mono should issue a best practice compiler warning too... 

-----Original Message-----
From: mono-devel-list-bounces at lists.ximian.com
[mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Marek Safar
Sent: Wednesday, August 13, 2008 12:00 PM
To: Aaron Colwell
Cc: mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] Unexpected compiler errors when using "as" keyword

Hello Aaron,
>
> I've been trying to port some C# code to mono and encountered a 
> difference with how gmcs & Visual Studio handle the "as" keyword. The 
> code below is a simple repro case that demonstrates the problem.
>
> using System;
>
> namespace AsStringProblem
> {
>  class MainClass
>  {
>   public static void Main(string[] args)
>   {
>    object o = "Hello World";
>    Console.WriteLine(o as string  + "blah");   // A. Error in Mono
>    Console.WriteLine((o as string)  + "blah"); // B. Ok
>    Console.WriteLine("blah" + o as string);    // C. Ok
>    
>   }
>  }
> }
>
Please report this as a compiler bug.

http://www.mono-project.com/Bugs

Thanks
Marek
_______________________________________________
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