[SOLVED] System.Linq.Dynamic does not support OrderByDescending("someColumn")?


Ok so in our project I’m using System.Linq.Dynamic library but I just noticed that I cannot do the following:


Because I get the following error:

Overload resolution failed because no accessible OrderByDescending can be called with these arguments…

It seems that the Library only support OrderBy("someColumnName"). Is there a reason for this and how would I bypass this issue if I want to reorder the records in descending order? Do I have to user Reverse() for example OrderBy("someColumnName").Reverse()? Seems like a hack…

Any advice would be greatly appreciated…


Assuming that you are using the DynamicQuery Helper files from the Microsoft sample library (Which are in the namespace System.Linq.Dynamic) then after reading the source code it looks like you need to specify the ordering you want as follows:

myDataSource.OrderBy("someColumnName descending")

Answered By – Leom Burke

Answer Checked By – David Marino (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *