Skip to content

"Range Sugar" issue... #79

@DualBrain

Description

@DualBrain

Was working my way through some samples located at https://blog.ndepend.com/top-10-new-net-6-0-api/

The LINQ now works with Index and Range operators...

// 6 element indexed from 0 to 5
var arr = new [] {0, 1, 2, 3, 4, 5};
Assert.IsTrue(arr.ElementAt(^2) == 4); // Take the second element from the end

This fails to convert... will have to think how to handle translating to VB. My initial reaction is that the ^2 basically translates to the length of the variable containing the elements minus the value, so something like:

AssertIsTrue(arr.ElementAt(arr.Length - 2) = 4)

May also have to look at the ^2...2 version as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions