NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error CS0223

Cannot have a null string case label

A switch statement cannot test for a null string.

The following sample generates CS0223:

public class MyClass {
   public static void Main() {
      string s = "test";
      switch (s) {
         case null:   // CS0223
         // try the following line instead
         // case "test":
            System.Console.WriteLine("in a case");
            return;
         default:
            System.Console.WriteLine("in default");
      }
   }
}