How to Resolve Error "CS0544: 'property override': cannot override because 'non-property' is not a property" in C#
The Compiler Error CS0544 is an inheritance mismatch error. The message reads: " 'Child.Member': cannot override because 'Parent.Member' is not a property".
In C#, the override keyword is strictly typed. You can only override a property with another property. You cannot override a field (variable) or a method with a property, even if they share the same name and return type. This generally happens when you try to replace a base class field with a derived class property to add logic (getters/setters).
This guide explains how to align your base and derived class members to allow overriding.
Understanding Member Type Compatibility
Polymorphism (Virtual/Override) allows you to swap the implementation of a member. However, the kind of member must remain consistent.
- Field (
int x;): Direct memory storage. Cannot bevirtual. Cannot be overridden. - Property (
int X { get; }): Method calls disguised as field access. Can bevirtual. Can be overridden.
You cannot turn a Field into a Property via inheritance because the underlying mechanics (memory access vs. function call) are fundamentally different.
Scenario 1: Attempting to Override a Field
This is the most common cause. The base class has a public field (variable). The derived class wants to override it to add validation logic in a setter, so the developer declares it as a property with override.
Example of error
public class User
{
// This is a Field. It cannot be virtual.
public string Name;
}
public class Admin : User
{
// ⛔️ Error CS0544: 'Admin.Name': cannot override because 'User.Name' is not a property.
public override string Name
{
get { return base.Name; }
set { base.Name = value.ToUpper(); }
}
}
Solution: Convert Base Field to Property
If you can modify the base class, change the field to a Virtual Property. Auto-properties make this easy and syntactically similar to fields.
public class User
{
// ✅ Correct: Changed to a virtual Property.
public virtual string Name { get; set; }
}
public class Admin : User
{
private string _name;
// ✅ Correct: Now we are overriding a Property with a Property.
public override string Name
{
get { return _name; }
set { _name = value.ToUpper(); }
}
}
Scenario 2: Naming Conflict with a Method
Sometimes developers accidentally name a property exactly the same as a method in the base class (often confusing GetName() with GetName).
Example of error
public class Data
{
// Base member is a Method
public virtual int Value()
{
return 10;
}
}
public class SmartData : Data
{
// ⛔️ Error CS0544: You cannot override a Method with a Property.
public override int Value
{
get { return 20; }
}
}
Solution: Rename or Match Type
Either rename the property to avoid the collision, or (if you intended to change the logic) override it as a method.
public class SmartData : Data
{
// ✅ Correct: Overriding a method with a method.
public override int Value()
{
return 20;
}
// OR
// ✅ Correct: Using a distinct name for the property
public int ValueProperty
{
get { return 20; }
}
}
Scenario 3: Hiding Members (Shadowing)
If you cannot modify the base class (e.g., it comes from a compiled library), you physically cannot use override because you cannot change the base member to virtual.
In this case, you must use the new keyword to hide (shadow) the base member.
Example of error
Using override on a library class field.
// Defined in a DLL we cannot change
public class LibraryItem
{
public int Id; // Field
}
public class MyItem : LibraryItem
{
// ⛔️ Error CS0544: Cannot override a field.
public override int Id { get; set; }
}
Solution: Use new
Use new to tell the compiler: "I know the parent has a field named Id. Ignore it. I am making a new property also named Id."
public class MyItem : LibraryItem
{
// ✅ Correct: 'new' hides the base field.
public new int Id { get; set; }
}
Behavior Note:
MyItem item = new MyItem(); item.Id = 5;accesses the Property.LibraryItem item = new MyItem(); item.Id = 5;accesses the Base Field. Shadowing breaks polymorphism.
Conclusion
CS0544 enforces strict member type matching in inheritance.
- Identify the Member: Look at the Base Class member you are trying to override.
- Is it a Field? If yes, you must change the Base Class to use a
virtual property. - Is it a Method? If yes, you must override it with a method, or rename your property.
- Can't change Base? Use the
newkeyword instead ofoverrideto hide the member.