Compiler Error CS0126
TOC
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Compiler Error CS0126

An object of a type convertible to 'type' required

A return statement is present, but the statement does not return a value of the expected type.

The following sample generates CS0126:

// CS0126.cs
public class a
{
   public int i
   {
      set
      {
      }
      get
      {
         return;   // CS0126, specify a value to return
      }
   }
}
Show:
© 2016 Microsoft