Compiler error ยท error CS0117

'X' does not contain a definition for 'Y'

The class is fine โ€” the member name isn't. This is the type-level twin of CS1061: you went through the class name instead of an object.

See it happen

Console.WritLine("hello");   // 'WritLine' is missing a t โ€” WriteLine

The message names the class it searched (Console), so you know the type resolved. The only question left is the spelling after the dot.

The typos everyone makes

You wroteC# wantsNote
Console.WritLineConsole.WriteLinemissing e
Console.writelineConsole.WriteLinePascalCase
Math.SqrMath.Sqrtmissing t
Math.PiMath.PIall caps
string.Format vs String.Formatboth existidentical type
int.Parse vs Int32.Parseboth existalias vs class name

Cause 1: a typo (nearly always)

Console.WriteLine(Math.Sqr(16));
Console.WriteLine(Math.Sqrt(16));   // correct name

Cause 2: the member exists but isn't static

If the member is an instance member, you can't reach it through the class name โ€” you need an object:

class Counter
{
    public int Value = 0;              // instance field

    public static int Total = 0;       // static field
}

Counter.Total = 5;      // โœ“ static: reached through the class
// Counter.Value = 5;   // โœ— no static Value exists
var c = new Counter();
c.Value = 5;            // โœ“ instance: reached through the object

Cause 3: wrong class entirely

Sometimes the method is real, but lives on a different type. Length belongs to strings and arrays; Count belongs to lists. Console.Length exists nowhere:

int.Prase("5");              // int has Parse โ€” not Prase
string.Jion(",", new string[0]);   // string has Join โ€” not Jion
Console.WriteLine(int.Parse("5"));            // correct name
string[] parts = { "a", "b" };
Console.WriteLine(string.Join("-", parts));   // and Join works

CS0117 vs CS1061 โ€” one line each

CodeYou wroteMeaning
CS0117Type.MemberNo such member on that type
CS1061obj.MemberNo such member on that object's type

Same fix โ€” check spelling, then check that you're on the right type.

Frequently asked

What does CS0117 mean?

The type exists but has no member with that name โ€” usually a typo in a static member like Console.WritLine or Math.Sqr.

Difference from CS1061?

CS0117 goes through the type name (Type.Member); CS1061 goes through an instance (obj.Member). Same cause, same fix.

Checklist