Interface First Letter

ID

csharp.interface_first_letter

Severity

info

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Naming Convention

Language

CSharp

Tags

naming

Description

Reports C# interface declarations whose name does not follow the IPascalCase convention: every interface name must start with an uppercase I followed by another uppercase letter (e.g. IDisposable, IService, IComparable).

Single-letter names are skipped because they cannot satisfy the two-character pattern.

Rationale

The .NET design guidelines mandate the I prefix on every interface so that readers can tell at a glance whether a type reference is an interface or a class. Tooling and frameworks rely on this convention; an interface called Service or iService breaks readers' expectations.

public interface IService { }      // OK
public interface IDisposable { }   // OK
public interface Service { }       // FLAW — missing I prefix
public interface iService { }      // FLAW — lowercase i
public interface IFoo { }          // OK
public interface Ifoo { }          // FLAW — second character not uppercase

Remediation

Rename the interface so it starts with I followed by an uppercase letter. For example, rename Service to IService.