using System;

namespace SpecSoft.Lib {

  public class Test {

    public static void Main() {
      string model = "TSP100";

      System.Console.WriteLine("switch on '{0}'", model);

      switch(model) {
        case "wibble":
        case null:
          System.Console.WriteLine("case null !!!!");
          break;
        case "TSP100":
          System.Console.WriteLine("case TSP100");
          break;
      }
    }

  }
}

[EMAIL PROTECTED] Test]$ mcs Test.cs
[EMAIL PROTECTED] Test]$ mono Test.exe
switch on 'TSP100'
case null !!!!

Reordering the first two cases to

using System;

namespace SpecSoft.Lib {

  public class Test {

    public static void Main() {
      string model = "TSP100";

      System.Console.WriteLine("switch on '{0}'", model);

      switch(model) {
        case null:
        case "wibble":
          System.Console.WriteLine("case null !!!!");
          break;
        case "TSP100":
          System.Console.WriteLine("case TSP100");
          break;
      }
    }

  }
}

Gives the correct output:

[EMAIL PROTECTED] Test]$ mcs Test.cs
[EMAIL PROTECTED] Test]$ mono Test.exe
switch on 'TSP100'
case TSP100

Using mono 1.1.15 on CentOS 4 Linux.

The same code, compiled using MS C#, but run under Mono, gives the correct 
output.

Posted as bug 78860, as I couldn't find anything similar.

-- 
Nikki Locke, Trumphurst Ltd.      PC & Unix consultancy & programming
http://www.trumphurst.com/


_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to