System.String Methods

LINQ to SQL does not support the following String methods.

Unsupported System.String Methods in General

Unsupported String methods in general:

  • Culture-aware overloads (methods that take a CultureInfo / StringComparison / IFormatProvider).

  • Methods that take or produce a char array.

Unsupported System.String Static Methods

Unsupported System.String Static Methods
String.Compare(String, String, Boolean)
String.Compare(String, String, Boolean, CultureInfo)
String.Compare(String, Int32, String, Int32, Int32)
String.Compare(String, Int32, String, Int32, Int32, Boolean)
String.Compare(String, Int32, String, Int32, Int32, Boolean, CultureInfo)
String.CompareOrdinal(String, String)
String.CompareOrdinal(String, Int32, String, Int32, Int32)

Unsupported System.String Non-static Methods

Unsupported System.String Non-static Methods

Differences from .NET

  • Queries do not account for SQL Server collations that might be in effect on the server, and therefore will provide culture-sensitive, case-insensitive comparisons by default. This behavior differs from the default, case-sensitive semantics of the .NET Framework.

  • When LastIndexOf returns 0, either the string is NULL or the found position is 0.

  • Unexpected results might be returned from concatenation or other operations on fixed-length strings (CHAR, NCHAR), because these types automatically have padding applied in the database.

  • Because many methods, such as Replace, ToLower, ToUpper, and the character indexer, have no valid translation for TEXT or NTEXT columns and XML, SqlExceptions occur if translated normally. This behavior is considered acceptable for these types. However, all string operations must match common language runtime (CLR) semantics for VARCHAR, NVARCHAR, VARCHAR(max), and NVARCHAR(max).

See Also

Data Types and Functions