Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ToSortClause Method (DbExpression, String)
Collapse the table of content
Expand the table of content

DbExpressionBuilder.ToSortClause Method (DbExpression, String)

.NET Framework 4.6 and 4.5

Creates a new DbSortClause with an ascending sort order and the specified collation.

Namespace:  System.Data.Common.CommandTrees.ExpressionBuilder
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public static DbSortClause ToSortClause(
	this DbExpression key,
	string collation


Type: System.Data.Common.CommandTrees.DbExpression

The expression that defines the sort key.

Type: System.String

The collation to sort under.

Return Value

Type: System.Data.Common.CommandTrees.DbSortClause
A new sort clause with the given sort key and collation, and ascending sort order.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DbExpression. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).


key is null.


collation is empty or contains only space characters.


key does not have an order-comparable result type.

.NET Framework

Supported in: 4.6, 4.5
© 2015 Microsoft