Description
Manual traversal ofAllInterfaces and BaseType chains is error-prone and verbose. ANcpLua.Roslyn.Utilities provides Implements() and InheritsFrom() extension methods for cleaner type hierarchy checks.
Bad Code
Good Code
Properties
- Category: Usage
- Severity: Info
- Enabled by default: True
- Code fix available: False
Configuration
Notes
The type hierarchy extension methods:Implements()- checksAllInterfacesfor interface implementationInheritsFrom()- traversesBaseTypechain for inheritance- Both handle null checks automatically
- Support simple names or fully qualified type names
- More readable and less error-prone than manual loops
