paul1956 / CSharpToVB

New version of CSharpToVB converter
MIT License
26 stars 9 forks source link

"Range Sugar" issue... #79

Open DualBrain opened 3 years ago

DualBrain commented 3 years ago

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.

paul1956 commented 3 years ago

@DualBrain I think I only partly support that feature. I will look at it or you can if you want something simple to work on. Just fork the repo and create a branch for this. also if you want to finish Dark Mode, that should be a separate branch.