This documentation is archived and is not being maintained.
MimeTextMatchCollection.Contains Method
.NET Framework 1.1
Returns a value indicating whether the specified MimeTextMatch is a member of the MimeTextMatchCollection.
[Visual Basic] Public Function Contains( _ ByVal match As MimeTextMatch _ ) As Boolean [C#] public bool Contains( MimeTextMatch match ); [C++] public: bool Contains( MimeTextMatch* match ); [JScript] public function Contains( match : MimeTextMatch ) : Boolean;
Parameters
- match
- The MimeTextMatch for which to check collection membership.
Return Value
true if the match parameter is a member of the MimeTextMatchCollection; otherwise, false.
Example
[Visual Basic, C#, C++] The following example demonstrates the use of the Contains method.
[Visual Basic] ' Get an array instance of 'MimeTextMatch' class. Dim myMimeTextMatch(3) As MimeTextMatch myMimeTextMatchCollection = myMimeTextBinding.Matches ' Initialize properties of 'MimeTextMatch' class. For myInt = 0 To 3 ' Create the 'MimeTextMatch' instance. myMimeTextMatch(myInt) = New MimeTextMatch() myMimeTextMatch(myInt).Name = "Title" myMimeTextMatch(myInt).Type = "*/*" myMimeTextMatch(myInt).IgnoreCase = True If True = myMimeTextMatchCollection.Contains(myMimeTextMatch(0)) Then myMimeTextMatch(myInt).Name = "Title" + Convert.ToString(myInt) myMimeTextMatch(myInt).Capture = 2 myMimeTextMatch(myInt).Group = 2 myMimeTextMatchCollection.Add(myMimeTextMatch(myInt)) Else myMimeTextMatchCollection.Add(myMimeTextMatch(myInt)) myMimeTextMatchCollection(myInt).RepeatsString = "2" End If Next myInt myMimeTextMatchCollection = myMimeTextBinding.Matches ' Copy collection to 'MimeTextMatch' array instance. myMimeTextMatchCollection.CopyTo(myMimeTextMatch, 0) [C#] // Get an array instance of 'MimeTextMatch' class. MimeTextMatch[] myMimeTextMatch = new MimeTextMatch[4]; myMimeTextMatchCollection = myMimeTextBinding.Matches; // Initialize properties of 'MimeTextMatch' class. for( myInt = 0 ; myInt < 4 ; myInt++ ) { // Create the 'MimeTextMatch' instance. myMimeTextMatch[ myInt ] = new MimeTextMatch(); myMimeTextMatch[ myInt ].Name = "Title"; myMimeTextMatch[ myInt ].Type = "*/*"; myMimeTextMatch[ myInt ].IgnoreCase = true; if( true == myMimeTextMatchCollection.Contains( myMimeTextMatch[ 0 ] ) ) { myMimeTextMatch[ myInt ].Name = "Title" + Convert.ToString( myInt ); myMimeTextMatch[ myInt ].Capture = 2; myMimeTextMatch[ myInt ].Group = 2; myMimeTextMatchCollection.Add( myMimeTextMatch[ myInt ] ); } else { myMimeTextMatchCollection.Add( myMimeTextMatch[ myInt ] ); myMimeTextMatchCollection[ myInt ].RepeatsString = "2"; } } myMimeTextMatchCollection = myMimeTextBinding.Matches; // Copy collection to 'MimeTextMatch' array instance. myMimeTextMatchCollection.CopyTo( myMimeTextMatch, 0 ); [C++] // Get an array instance of 'MimeTextMatch' class. MimeTextMatch* myMimeTextMatch[] = new MimeTextMatch*[4]; myMimeTextMatchCollection = myMimeTextBinding->Matches; // Initialize properties of 'MimeTextMatch' class. for( myInt = 0 ; myInt < 4 ; myInt++ ) { // Create the 'MimeTextMatch' instance. myMimeTextMatch[ myInt ] = new MimeTextMatch(); myMimeTextMatch[ myInt ]->Name = S"Title"; myMimeTextMatch[ myInt ]->Type = S"*/*"; myMimeTextMatch[ myInt ]->IgnoreCase = true; if( true == myMimeTextMatchCollection->Contains( myMimeTextMatch[ 0 ] ) ) { myMimeTextMatch[ myInt ]->Name = String::Format( S"Title{0}", Convert::ToString(myInt) ); myMimeTextMatch[ myInt ]->Capture = 2; myMimeTextMatch[ myInt ]->Group = 2; myMimeTextMatchCollection->Add( myMimeTextMatch[ myInt ] ); } else { myMimeTextMatchCollection->Add( myMimeTextMatch[ myInt ] ); myMimeTextMatchCollection->Item[ myInt ]->RepeatsString = S"2"; } } myMimeTextMatchCollection = myMimeTextBinding->Matches; // Copy collection to 'MimeTextMatch' array instance. myMimeTextMatchCollection->CopyTo( myMimeTextMatch, 0 );
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
MimeTextMatchCollection Class | MimeTextMatchCollection Members | System.Web.Services.Description Namespace
Show: