Skip to main content
Source: AL0030UseTypeHierarchyAnalyzer.cs

Description

Manual traversal of AllInterfaces 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() - checks AllInterfaces for interface implementation
  • InheritsFrom() - traverses BaseType chain for inheritance
  • Both handle null checks automatically
  • Support simple names or fully qualified type names
  • More readable and less error-prone than manual loops