我有此型号的清单: 型号1
public class Model1//: IConvertible
{
public int p1 { get; set; }
public string p2{ get; set; }
}
我正在尝试从另一个表进行linq查询,以使用 Model1
的列表获取数据List<Model1> lList = GetModel();
var test = Model2.Where(p => lList .Any(l => p.p1== l.p1 && p.p2== l.p2)).ToList();
我想念什么?
答案 0 :(得分:0)
我将Lin和p1 + p2连接起来
<form class="subscription__form">
<div class="form__email-input">
<div class="email-input__field">
<label for="email-ies20" class="boo5QN kuXeGY ZNyelS j5539W Kp7mbJ _6UybFe yOshI6 Vg2G-X QAKJaP">
</label>
<input type="email" class="ptY7iQ xm3894 BPoM1b -T32DO j5539W Kp7mbJ JwPapm yOshI6 OJgqNz I7nA9N _7lPid_ pAtLTY ARyIjR _-4XiAI i9UcX3 ySMwvO _1E7gq- KHXx7q" value="" id="email-ies20" placeholder="">
</div>
</div>
<button class="form__btn jjY3sP ebuQjF i9UcX3 zb5H0w v7Z8MH DH77jT I7nA9N _1VH7VL -lZ0bD lRd-jf fXQLl7 BG_g-B _0DRKyg Ip_fOg Xf3Nnr FDkAoY KHXx7q RkhiHe ajUhiu IB2dWZ ZJBY2X _4U-qxG FfEhSH ee0PKn CoasA5"><span class="_6xw_O3 _85MuCJ HgyryE I7nA9N o4bIWm kuXeGY ZNyelS j5539W Kp7mbJ _6UybFe yOshI6 Vg2G-X"><span class="save-text-container">Zapisz</span></span><svg class="dx-icon ODgekj VPvVHW -QUg1Q XRBrCa Yq7G-r qH0D36 qIhDFL" height="1em" width="1em" focusable="true" fill="currentColor" viewBox="0 0 24 24">
<path d="M12 2a10 10 0 0 0-7 17l1-1a8.5 8.5 0 1 1 6 2.5V22a10 10 0 0 0 0-20z">
</path>
</svg>
<svg class="dx-icon ODgekj qIhDFL" height="1em" width="1em" focusable="true" fill="currentColor" viewBox="0 0 24 24">
<path d="M11.3 19.9l-8.5-6.3 1.5-2 6.4 4.8 8.4-11.7L21 6 11.3 20z">
</path>
</svg>
<svg class="dx-icon ODgekj qIhDFL" height="1em" width="1em" focusable="true" fill="currentColor" viewBox="0 0 24 24">
<path d="M19.6 5.5l-1-1.1-6.6 6.5-6.5-6.5-1.1 1 6.5 6.6-6.5 6.5 1 1.1 6.6-6.5 6.5 6.5 1.1-1-6.5-6.6 6.5-6.5z">
</path>
</svg>
</button>
</form>
然后在另一个查询中使用此列表是:
var stringKeys = lList.Select((e, i) => lList[i].p1.ToString() + "_" + lList[i].p2).ToList();