Gobln.Orderby allow you to order IEnumerable or IQueryable by dynamic properties. Also you can define IComparer to the dynamic property.
You can also define an array of dynamic properties by which to order.
This libery also contains a natural sort comparer
- .Net 4.0 and higher
- .Net Core 1.0 and higher
- .Net Core 2.0 and higher
- .Net Core 3.0 and higher
- .Net Standard 2.0 and higher
Install Gobln.OrderBy, trough Nuget or other means.
TestData.MoonWalkers.OrderBy(" firstname Desc; LunarEvaDate asc ; ").ToList();
TestData.MoonWalkers.OrderBy("lunarevadate", OrderDirectionEnum.Descending).ToArray()
TestData.MoonWalkers.OrderBy("FirstName", new NaturalSortComparer()).ThenBy("GuiId", OrderDirectionEnum.Ascending, new NaturalSortComparer()).ToList()
var orderItems = new List<OrderItem>{
new OrderItem(){ SortColum = "LunarEvaDate", OrderDirection = OrderDirectionEnum.Descending },
new OrderItem(){ SortColum = "Remark" }
};
TestData.MoonWalkers.OrderBy(orderItems).ToArray();
For more examples, check the test project
The project is on Nuget. Install via the NuGet Package Manager.
PM > Install-Package Gobln.OrderBy
I'm going to provide an documentation file, but haven't started on one yet. As for the Readme file, if there are any inconsitencies or grammatical errors feel free to let me know by an pull request. This also counts for problems in de code.
- If something is broken and you know how to fix it, send a pull request.
- If you have no idea what is wrong, create an issue.
If you have something you'd like to improve do not hesitate to send a Pull Request