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

Marek Safar marek.safar at seznam.cz
Wed Aug 13 15:00:15 EDT 2008


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


More information about the Mono-devel-list mailing list