MimeTextMatchCollection.Remove Method
Removes the first occurrence of the specified MimeTextMatch from the MimeTextMatchCollection.
[Visual Basic] Public Sub Remove( _ ByVal match As MimeTextMatch _ ) [C#] public void Remove( MimeTextMatch match ); [C++] public: void Remove( MimeTextMatch* match ); [JScript] public function Remove( match : MimeTextMatch );
Parameters
- match
- The MimeTextMatch to remove from the collection.
Remarks
This method performs a linear search; therefore, the average execution time is proportional to Count.
The elements that follow the removed MimeTextMatch move up to occupy the vacated spot.
Example
[Visual Basic, C#, C++] The following example demonstrates the use of the Remove method.
[Visual Basic] ' Get an instance of 'MimeTextMatchCollection'. Dim myMimeTextMatchCollection1 As New MimeTextMatchCollection() Dim myMimeTextMatch1(4) As MimeTextMatch myMimeTextMatchCollection1 = myMimeTextBinding1.Matches For myInt = 0 To 3 myMimeTextMatch1(myInt) = New MimeTextMatch() myMimeTextMatch1(myInt).Name = "Title" + Convert.ToString(myInt) If myInt <> 0 Then myMimeTextMatch1(myInt).RepeatsString = "7" End If myMimeTextMatchCollection1.Add(myMimeTextMatch1(myInt)) Next myInt myMimeTextMatch1(4) = New MimeTextMatch() ' Remove 'MimeTextMatch' instance from collection. myMimeTextMatchCollection1.Remove(myMimeTextMatch1(1)) ' Using MimeTextMatchCollection.Item indexer to comapre. If myMimeTextMatch1(2) Is myMimeTextMatchCollection1(1) Then ' Check whether 'MimeTextMatch' instance exists. myInt = myMimeTextMatchCollection1.IndexOf(myMimeTextMatch1(2)) ' Insert 'MimeTextMatch' instance at a desired position. myMimeTextMatchCollection1.Insert(1, myMimeTextMatch1(myInt)) myMimeTextMatchCollection1(1).RepeatsString = "5" myMimeTextMatchCollection1.Insert(4, myMimeTextMatch1(myInt)) End If [C#] // Get an instance of 'MimeTextMatchCollection'. MimeTextMatchCollection myMimeTextMatchCollection1 = new MimeTextMatchCollection(); MimeTextMatch[] myMimeTextMatch1 = new MimeTextMatch[5]; myMimeTextMatchCollection1 = myMimeTextBinding1.Matches; for( myInt = 0 ; myInt < 4 ; myInt++ ) { myMimeTextMatch1[ myInt ] = new MimeTextMatch(); myMimeTextMatch1[ myInt ].Name = "Title" + Convert.ToString( myInt ); if( myInt != 0 ) { myMimeTextMatch1[ myInt ].RepeatsString = "7"; } myMimeTextMatchCollection1.Add( myMimeTextMatch1[ myInt ] ); } myMimeTextMatch1[4] = new MimeTextMatch(); // Remove 'MimeTextMatch' instance from collection. myMimeTextMatchCollection1.Remove( myMimeTextMatch1[ 1 ] ); // Using MimeTextMatchCollection.Item indexer to comapre. if( myMimeTextMatch1[ 2 ] == myMimeTextMatchCollection1[ 1 ] ) { // Check whether 'MimeTextMatch' instance exists. myInt = myMimeTextMatchCollection1.IndexOf( myMimeTextMatch1[ 2 ] ); // Insert 'MimeTextMatch' instance at a desired position. myMimeTextMatchCollection1.Insert( 1, myMimeTextMatch1[ myInt ] ); myMimeTextMatchCollection1[ 1 ].RepeatsString = "5"; myMimeTextMatchCollection1.Insert( 4, myMimeTextMatch1[ myInt ] ); } [C++] // Get an instance of 'MimeTextMatchCollection'. MimeTextMatchCollection* myMimeTextMatchCollection1 = new MimeTextMatchCollection(); MimeTextMatch* myMimeTextMatch1[] = new MimeTextMatch*[5]; myMimeTextMatchCollection1 = myMimeTextBinding1->Matches; for( myInt = 0 ; myInt < 4 ; myInt++ ) { myMimeTextMatch1[ myInt ] = new MimeTextMatch(); myMimeTextMatch1[ myInt ]->Name = String::Format( S"Title{0}", Convert::ToString(myInt) ); if( myInt != 0 ) { myMimeTextMatch1[ myInt ]->RepeatsString = S"7"; } myMimeTextMatchCollection1->Add( myMimeTextMatch1[ myInt ] ); } myMimeTextMatch1[4] = new MimeTextMatch(); // Remove 'MimeTextMatch' instance from collection. myMimeTextMatchCollection1->Remove( myMimeTextMatch1[ 1 ] ); // Using MimeTextMatchCollection.Item indexer to comapre. if( myMimeTextMatch1->Item[ 2 ] == myMimeTextMatchCollection1->Item[ 1 ] ) { // Check whether 'MimeTextMatch' instance exists. myInt = myMimeTextMatchCollection1->IndexOf( myMimeTextMatch1[ 2 ] ); // Insert 'MimeTextMatch' instance at a desired position. myMimeTextMatchCollection1->Insert( 1, myMimeTextMatch1[ myInt ] ); myMimeTextMatchCollection1->Item[ 1 ]->RepeatsString = S"5"; myMimeTextMatchCollection1->Insert( 4, myMimeTextMatch1[ myInt ] ); }
[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