キーをため込みこむ場合などで重複なく追加するために
存在しない場合のみ追加する
List<string> testList = new List<string>();
testList.Add("AAA");
testList.Add("BBB");
string word = "CCC";
if (!testList.Contains(word )) testList.Add(word);
キーをため込みこむ場合などで重複なく追加するために
存在しない場合のみ追加する
List<string> testList = new List<string>();
testList.Add("AAA");
testList.Add("BBB");
string word = "CCC";
if (!testList.Contains(word )) testList.Add(word);
コメント