This documentation is archived and is not being maintained.

Compiler Error CS0176

Static member 'member' cannot be accessed with an instance reference; qualify it with a type name instead

Only a class name can be used to qualify a static variable; an instance name cannot be a qualifier.

The following sample generates CS0176:

// CS0176.cs
public class b
   public static int ii;

public class a
   public static void Main()
      b bb = new b();
      int i = bb.ii;   // CS0176
      // try the following line instead
      // int i = b.ii;