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.
int itemCount=3; prod.Add("P1"); prod.Add("P2"); prod.Add("P1"); prod.Add("P2"); prod.Add("P1"); prod.Add("P3");
この製品リストでは、各アイテムの数を取得したいので、数が一致する場合はitemCount配列に入れる必要があります。
itemCount
この場合、P1 のみを配列に配置する必要があります。
誰でも私を助けることができますか?C# のコードが必要です。
の場合prodは、IEnumerable<string>linq でこれを行うことができます
prod
IEnumerable<string>
var results = (from s in prod group s by s into g where g.Count() == itemCount select g.Key) .ToArray();