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 CS0202

The call to GetEnumerator must return a class or a struct, not 'type'

A call to GetEnumerator cannot return a pointer; it must return an instance.

The following sample generates CS0202:

public class C1 {
   public int Current {
      get {
         return 0;
      }
   }

   public bool MoveNext () {
      return false;
   }

   public static implicit operator C1 (int c1) {
      return 0;
   }

}
    
public class C2 {
   public int Current {
      get {
         return 0;
      }
   }

   public bool MoveNext () {
      return false;
   }

   public C1* GetEnumerator () {   // CS0202
   // try the following line instead
   // public C1 GetEnumerator () {
      return null;
   }
}

public class MainClass {
   unsafe public static void Main () {
      C2 c2 = new C2();
      foreach (C1 x in c2) {x = null;}
   }
}