Skip to main content

How to Resolve Error "CS0528: 'interface' is already listed in interface list" in C#

The Compiler Error CS0528 is a redundancy error. The message reads: " 'InterfaceName' is already listed in interface list".

In C#, when you define a class or struct, you provide a list of interfaces it implements after the colon (:). This error occurs if you include the exact same interface more than once in that specific comma-separated list. The compiler flags this as an error because declaring an implementation twice adds no value and indicates a likely typo or copy-paste mistake.

This guide explains how to identify and clean up these redundant declarations.

Understanding the Interface List​

When defining a type:

class MyClass : BaseClass, IInterface1, IInterface2
  • You can list as many distinct interfaces as you want.
  • You cannot list the exact same interface type twice in this specific list.

Unlike some logical errors, this is purely syntactic. The class either implements the interface or it doesn't; saying it twice doesn't make it implement it "more".

Scenario 1: Direct Duplicate Listing​

This is the standard cause. A developer copies and pastes an interface name or merges code and accidentally leaves a duplicate.

Example of error​

using System;

// ⛔️ Error CS0528: 'IDisposable' is already listed in interface list
public class ResourceHandler : IDisposable, ICloneable, IDisposable
{
public void Dispose() { }
public object Clone() => this;
}

Solution: Remove the Duplicate​

Simply delete the extra reference from the list.

using System;

// ✅ Correct: Each interface appears once
public class ResourceHandler : IDisposable, ICloneable
{
public void Dispose() { }
public object Clone() => this;
}

Scenario 2: Generic Interface Duplicates​

With generic interfaces, "sameness" is defined by the type arguments. IEnumerable<int> and IEnumerable<string> are different interfaces. However, IEnumerable<int> and IEnumerable<int> are the same, and listing both causes CS0528.

Example of error​

using System.Collections.Generic;

// ⛔️ Error CS0528: 'IEnumerable<int>' is already listed
public class NumberList : IEnumerable<int>, IEnumerable<int>
{
// ...
}

Solution: Distinct Types​

Ensure generic arguments differ if you intend to implement the interface multiple times (for different types).

using System.Collections.Generic;

// ✅ Correct: These are treated as distinct interfaces
public class MultiList : IEnumerable<int>, IEnumerable<string>
{
// Implementation for int
IEnumerator<int> IEnumerable<int>.GetEnumerator() => null;

// Implementation for string
IEnumerator<string> IEnumerable<string>.GetEnumerator() => null;

// ...
}

Distinction: Partial Classes and Inheritance​

It is important to know where this rule does not apply, as it might confuse you during refactoring.

Partial Classes (Allowed)​

If you use partial classes, you can list the same interface in different files. The compiler merges them intelligently without throwing CS0528.

// File 1
public partial class User : IDisposable { }

// File 2
// ✅ Valid: Repeating the interface here is redundant but allowed.
public partial class User : IDisposable { }

Inheritance (Allowed)​

If a Base Class implements an interface, the Child Class is allowed to list it again (Re-implementation). This is not CS0528.

public class Base : IDisposable { ... }

// ✅ Valid: Explicitly restating that Child implements IDisposable
public class Child : Base, IDisposable { ... }

CS0528 only triggers when the duplicate is on the exact same declaration line.

Conclusion​

CS0528 is a housekeeping error.

  1. Check the List: Look at the declaration line class X : ....
  2. Find the Duplicate: Scan for repeated names.
  3. Delete: Remove the extra entry.