C#

C#

Made by DeepSource

You can drop the lower bound in a range expression if is zero CS-R1072

Anti-pattern
Major
Autofix

Range expression allows you to specify the lower bound and the upper bound using the .. operator. This can be useful to slice an array or a string. However, mentioning no lower bound is implicitly same as setting it to 0. Therefore, you can safely drop the lower bound in such cases.

Bad Practice

var firstTwo = arr[0..2];

Recommended

var firstTwo = arr[..2];

Reference