【问题标题】:Getting the value of a key in an AttributeCollection using LINQ使用 LINQ 获取 AttributeCollection 中键的值
【发布时间】:2012-04-07 20:41:58
【问题描述】:

我正在使用 CRM 插件在 LINQPad 中对此进行测试。

我的查询应该是什么才能返回“address1_addressid”的值?

【问题讨论】:

    标签: linq dynamics-crm-2011 linqpad


    【解决方案1】:

    可能是这样的

    from c in ContactSet
    where ...
    select new {
      address1_addressid = c.Attributes.Contains("address1_addressid") ? 
                           c.Attributes["address1_addressid"] : ""
    }
    

    【讨论】:

      【解决方案2】:

      或者干脆

      from c in ContactSet
      where c.FirstName.Equals("SomeFirstName")
      select c.Address1_AddressId
      

      【讨论】:

      • 我在我的环境中对其进行了测试,它可以工作......但是,使用适合你的方法
      猜你喜欢
      • 2011-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-03
      相关资源
      最近更新 更多