Export (0) Print
Expand All
Expand Minimize

Compiler Error CS1518

Expected class, delegate, enum, interface, struct, or union

A declaration was found that is not supported in a namespace. Inside a namespace, the compiler accepts only classes, structs, enums, interfaces, namespaces, and delegates.

The following sample generates CS1518:

// CS1518.cs
namespace x
{
   sealed class c1 {};      // OK
   namespace f2 {};         // OK
   sealed f3 {};            // CS1518
}
Show:
© 2014 Microsoft