LinkedList.Contains メソッド
アセンブリ: System (system.dll 内)
構文
Dim instance As LinkedList(Of T) Dim value As T Dim returnValue As Boolean returnValue = instance.Contains(value)
- value
LinkedList 内で検索される値。参照型の場合、null 参照 (Visual Basic では Nothing) の値を使用できます。
value が LinkedList に存在する場合は true。それ以外の場合は false。
使用例
Contains メソッドのコード例および出力を次に示します。このコード例では、文字列の配列を作成し、その文字列の配列をコンストラクタに渡すことによって、LinkedList を作成し、データを読み込みます。最後に、Contains メソッドを使用して、リストに特定の文字列が含まれているかどうかをテストします。
このコード例および出力は、LinkedList クラスのトピックで取り上げている例の一部分です。
Dim words() As String = _ { "the", "fox", "jumped", "over", "the", "dog" } Dim sentence As New LinkedList(Of String)(words) Display(sentence) Console.WriteLine("sentence.Contains(""jumped"") = {0}", _ sentence.Contains("jumped")) <br /><span space="preserve">...</span><br />'the fox jumped over the dog 'sentence.Contains("jumped") = True
string[] words = {"the", "fox", "jumped", "over", "the", "dog"}; LinkedList<string> sentence = new LinkedList<string>(words); Display(sentence); Console.WriteLine("sentence.Contains(\"jumped\") = {0}", sentence.Contains("jumped")); <br /><span space="preserve">...</span><br />//the fox jumped over the dog //sentence.Contains("jumped") = True
array<String^>^ words = {"the", "fox", "jumped", "over", "the", "dog"}; LinkedList<String^>^ sentence = gcnew LinkedList<String^>((IEnumerable<String^>^) words); Display(sentence); Console::WriteLine("sentence->Contains(\"jumped\") = {0}", sentence->Contains("jumped")); <br /><span space="preserve">...</span><br />//the fox jumped over the dog //sentence->Contains("jumped") = True
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
LinkedList ジェネリック クラス
LinkedList メンバ
System.Collections.Generic 名前空間
Find
FindLast
その他の技術情報
カルチャを認識しないコレクションの操作の実行
- LinkedList.Contains メソッドのページへのリンク