Skip to content

Extension methods to use strings in LINQ OrderBy and ThenBy methods

License

Notifications You must be signed in to change notification settings

Grax32/OrderByString

Repository files navigation

OrderByString

Extension methods to use strings in LINQ OrderBy and ThenBy methods Enable the extensions methods by including a reference and a "using OrderByExtensions;" statement

Supports the following formats:

    ().OrderBy("Property").ThenBy("OtherProperty");
    ().OrderBy("Property desc").ThenBy("OtherProperty desc");
    ().OrderByDescending("Property").ThenByDescending("OtherProperty");
    ().OrderBy("Property desc, OtherProperty asc");
    ().OrderBy("Property, OtherProperty desc");

.OrderBy and .ThenBy default to ascending, OrderByDescending and ThenByDescending default to descending

"asc" or "desc" in the text takes precedence over the default from the command so that ().OrderBy("Property asc") does the same thing as ().OrderByDescending("Property asc")

About

Extension methods to use strings in LINQ OrderBy and ThenBy methods

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages