C
C#3w ago
Brain

In LINQ to SQL, does Select after OrderBy preserve the ordering?

And what if I want to call ThenBy after the Select? Can I just cast to IOrderedQueryable? Or is there a better method?
5 Replies
blueberriesiftheywerecats
You can call method that returns sql query in string format and check it ToQueryString()
Brain
BrainOP3w ago
@blueberriesiftheywerecats meaning it's not guaranteed?
blueberriesiftheywerecats
I mean, I don't really know answer to your question, but if you know sql you can check it yourself (I think it will preserve ordering)
Brain
BrainOP3w ago
Ok, thank you
blueberriesiftheywerecats
Select will just change the select statement in sql query, so it doesn't matter whether you call it after or before sorting afaik
Want results from more Discord servers?
Add your server