【问题标题】:How to execute LINQ query at runtime c# [duplicate]如何在运行时执行 LINQ 查询 c# [重复]
【发布时间】:2020-09-14 12:35:31
【问题描述】:
"((IEnumerable)sourceData).Cast().Select(ob => 
    new 
    { 
        SenderId = "Expo-HSE-01", 
        IssueId = ob.IncidentNo.Value, 
        IssuePointId = String.Join(",", ((IEnumerable)ob.TypeofIncident)
            .Cast()
            .Select(ip => ip.Value)), 
        IssueTypeId = "Issue-HSE-General", 
        ZoneId = ob.Location.LocationCode.Value 
    }"

以字符串形式获取上述查询需要在运行时执行。

【问题讨论】:

标签: c# linq dynamic


【解决方案1】:

Parse string into a LINQ query

CSharpScripting 能够以字符串形式执行代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-02
    • 2020-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多