Compiler Error CS0175
Use of keyword 'base' is not valid in this context
The base keyword must be used to specify a particular member of the base class. For more information, see Constructors.
The following sample generates CS0175:
C#
// 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;
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: