Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我有一本这样的字典
("ABC","X") ("CDE","C") ("EFG","X")
我需要检索位于两侧的项目"C",如何使用 linq 实现这一点?
"C"
预期输出:
项目 = n / 输出 = (n-1)(n+1) 个项目
("ABC","X")和 ("EFG","X")
("ABC","X")
("EFG","X")
像这样的东西?Dict.TakeWhile(e => e.Value = "C").Take(1).Reverse().Take(3)。
然后去掉中间的那个。