LoginSignup
0
0

More than 5 years have passed since last update.

ExceptとIntersect

Posted at

ExceptとIntersect

List<string> doneList = new List<string>{ "買い物", "掃除", "洗濯"};
List<string> toDoList = new List<string> { "買い物", "掃除", "洗濯", "通院" };

// 済んでいないアクション項目
foreach (var a in toDoList.Except(doneList))
{
    Debug.WriteLine(a); // 通院
}

// 済んだアクション項目
foreach (var a in toDoList.Intersect(doneList))
{
    Debug.WriteLine(a); // 買い物 掃除 洗濯
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0