rspec/rules/S6608/why-dotnet.adoc

9 lines
701 B
Plaintext

== Why is this an issue?
Indexes in C# provide direct access to an element at a specific position within an array or collection. When compared to `Enumerable` methods, indexing can be more efficient for certain scenarios, such as iterating over a large collection, due to avoiding the overhead of checking the underlying collection type before accessing it.
This applies to types that implement one of these interfaces:
* https://learn.microsoft.com/en-us/dotnet/api/system.collections.ilist[IList]
* https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ilist-1[IList<T>]
* https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlylist-1[IReadonlyList<T>]