0

I've tried the following:

var tags in c.Tags.Split(',').OrderBy( x > x )

where c.Tags is a string of tags seperated by ',', is there a way I can sort it with OrderBy?

2
  • 13
    You already have the answer (just change in to = and > to =>) Commented Aug 31, 2014 at 6:26
  • 1
    Can also be done without Linq, with var tags = c.Tags.Split(','); Array.Sort(tags);. Commented Aug 31, 2014 at 7:12

1 Answer 1

2

Yes, if you're using this in a foreach:

foreach(var tags in c.Tags.Split(',').OrderBy( x => x ))
{
   //...
}

or as an assignment:

var tags = c.Tags.Split(',').OrderBy( x => x );
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.