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 Non-static Methods
Unsupported System.String Non-static Methods |
---|
String.IndexOfAny(Char[]) |
String.Split |
String.ToCharArray() |
String.ToUpper(CultureInfo) |
String.TrimEnd(Char[]) |
String.TrimStart(Char[]) |
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 isNULL
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 forTEXT
orNTEXT
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 forVARCHAR
,NVARCHAR
,VARCHAR(max)
, andNVARCHAR(max)
.