C# string Reverse extension method

This post is a simple, fun example. In this post, I will show you a neat trick about LINQ. You have to reverse a given sentence using LINQ. For example

I love LINQ


LINQ love I

There are several ways to solve this problem using LINQ. But we are going to use LINQ Aggregate the operator which I have already discussed in my post

var sentence="I Love LINQ"
var result=sentence.Aggregate((a,b)=>b +" "+ a);

Please do not post any spam link in the comment box😊

Post a Comment (0)
Previous Post Next Post