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
Input

I love LINQ

Output

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);
Next Post Previous Post
No Comment
Add Comment
comment url