Description
Null-coalescing with empty collections is verbose. ANcpLua.Roslyn.Utilities provides theOrEmpty() extension for cleaner null handling.
Bad Code
Good Code
Properties
- Category: Usage
- Severity: Info
- Enabled by default: True
- Code fix available: False
Configuration
Notes
- Works with arrays, lists, and any
IEnumerable<T> - Returns empty collection of the same type when null
- Reduces boilerplate in LINQ chains
