StringExtensions

Overview

The StringExtensions class contains a set of extension methods used to simplify string comparison operations in DA LINQ expressions. While most of the SQL dialects supported by Data Abstract support query conditions like

SELECT
...
WHERE
  [Some String Field] > "String Value"

while the most used .NET language (C#) doesn't allow <=, <, > and >= comparison operations on string values.

The StringExtensions class provides a way to express such conditions in DA LINQ operations using as simple notation as

var data = from x in dataAdapter.GetTable<DataTable>() where x.Name.IsGreaterThan("Some Value") select x;

Note: To call an extension method, you need to explicitly add the namespace this method is declared in to the using (C#)/Imports (VB.NET) or uses (Oxygene) clause.

Location

Instance Methods


IsEqualTo

Returns true if the first operand is equal to the second operand; false otherwise. String comparison operation is performed in the StringComparison.Ordinal mode.

 

method IsEqualTo(value: String): Boolean

 

Boolean IsEqualTo(String value)

 

Function IsEqualTo(value As String) As Boolean

Parameters:

  • value: Second operand

IsGreaterThan

Returns true if the first operand is greater than the second operand; false otherwise. String comparison operation is performed in the StringComparison.Ordinal mode.

 

method IsGreaterThan(value: String): Boolean

 

Boolean IsGreaterThan(String value)

 

Function IsGreaterThan(value As String) As Boolean

Parameters:

  • value: Second operand

IsGreaterThanOrEqualTo

Returns true if the first operand is greater than or equal to the second operand; false otherwise. String comparison operation is performed in the StringComparison.Ordinal mode.

 

method IsGreaterThanOrEqualTo(value: String): Boolean

 

Boolean IsGreaterThanOrEqualTo(String value)

 

Function IsGreaterThanOrEqualTo(value As String) As Boolean

Parameters:

  • value: Second operand

IsLessThan

Returns true if the first operand is less than the second operand; false otherwise. String comparison operation is performed in the StringComparison.Ordinal mode.

 

method IsLessThan(value: String): Boolean

 

Boolean IsLessThan(String value)

 

Function IsLessThan(value As String) As Boolean

Parameters:

  • value: Second operand

IsLessThanOrEqualTo

Returns true if the first operand is less than or equal to the second operand; false otherwise. String comparison operation is performed in the StringComparison.Ordinal mode.

 

method IsLessThanOrEqualTo(value: String): Boolean

 

Boolean IsLessThanOrEqualTo(String value)

 

Function IsLessThanOrEqualTo(value As String) As Boolean

Parameters:

  • value: Second operand

IsNotEqualTo

Returns true if the first operand is not equal to the second operand; false otherwise. String comparison operation is performed in the StringComparison.Ordinal mode.

 

method IsNotEqualTo(value: String): Boolean

 

Boolean IsNotEqualTo(String value)

 

Function IsNotEqualTo(value As String) As Boolean

Parameters:

  • value: Second operand

See Also