I have a lot of strings in my string array. I want to reverse it via LINQ. Although I can do it using a for loop using Array.Reverse, I wonder if I can do it using LINQ?
This is my code but its not working as expected:
string[] strTemp = new string[] {"Hello", "World", "Foo"};
string[] strResult = strTemp.Select((a, b) => new { Value = a, Index = b })
.Select(y => y.Value.ToCharArray().Reverse().ToString()).ToArray();
My expected result should be:
"olleH", "dlroW", "ooF"