EntityFunctions.Left 方法

[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]

作为 LINQ to Entities 查询的一部分使用时,此方法调用规范 Left 函数以返回字符串中最左侧指定数目的字符。

命名空间:  System.Data.Entity.Core.Objects
程序集:  EntityFramework(在 EntityFramework.dll 中)

语法

声明
<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId := "stringArgument")> _
<SuppressMessageAttribute("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId := "string")> _
<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId := "length")> _
<DbFunctionAttribute("Edm", "Left")> _
Public Shared Function Left ( _
    stringArgument As String, _
    length As Nullable(Of Long) _
) As String
用法
Dim stringArgument As String 
Dim length As Nullable(Of Long)
Dim returnValue As String 

returnValue = EntityFunctions.Left(stringArgument, _
    length)
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "stringArgument")]
[SuppressMessageAttribute("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "string")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "length")]
[DbFunctionAttribute("Edm", "Left")]
public static string Left(
    string stringArgument,
    Nullable<long> length
)
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA1801:ReviewUnusedParameters", MessageId = L"stringArgument")]
[SuppressMessageAttribute(L"Microsoft.Naming", L"CA1720:IdentifiersShouldNotContainTypeNames", MessageId = L"string")]
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA1801:ReviewUnusedParameters", MessageId = L"length")]
[DbFunctionAttribute(L"Edm", L"Left")]
public:
static String^ Left(
    String^ stringArgument, 
    Nullable<long long> length
)
[<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "stringArgument")>]
[<SuppressMessageAttribute("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "string")>]
[<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "length")>]
[<DbFunctionAttribute("Edm", "Left")>]
static member Left : 
        stringArgument:string * 
        length:Nullable<int64> -> string
public static function Left(
    stringArgument : String, 
    length : Nullable<long>
) : String

参数

返回值

类型:System.String
包含从输入字符串左侧算起的所请求的字符数的字符串。

备注

无法直接调用此函数。 此函数只能出现在 LINQ to Entities 查询中。 此函数将被转换为数据库中对应的函数。

请参阅

参考

EntityFunctions 类

System.Data.Entity.Core.Objects 命名空间