Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error CS0175 

Error Message

Use of keyword 'base' is not valid in this context

The base (C# Reference) keyword must be used to specify a particular member of the base class. For more information, see Constructors (C# Programming Guide).

The following sample generates CS0175:

// CS0175.cs
using System;
class BaseClass
{
    public int TestInt = 0;
}

class MyClass : BaseClass
{
    public static void Main()
    {
        MyClass aClass = new MyClass();
        aClass.BaseTest();
    }

    public void BaseTest()
    {
        Console.WriteLine(base); // CS0175
        // Try the following line instead:
        // Console.WriteLine(base.TestInt);
        base = 9;   // CS0175

        // Try the following line instead:
        // base.TestInt = 9;
    }
}

Community Additions

ADD
Show:
© 2015 Microsoft