Compiler Error CS0426

The type name 'identifier' does not exist in the type 'type'

This error occurs when you reference a type nested within another type, but no such nested type exists. This can occur if you mistype the name of the nested type. Check the spelling of the names used, and verify that the enclosing type has the expected member.

The following sample generates CS0426 because class C has no nested type A:

// CS0426.cs

class C
    // No nested types are declared.   

class D
   public static void Main()
       C c = new C();
       // Attempt to reference a nested type A:
       C.A a; // CS0426 because no such type C.A

See Also


Classes and Structs (C# Programming Guide)

Change History




October 2008

Changed explanatory text and example.

Customer feedback.