MimeTextMatchCollection.Item Property
Gets or sets the value of the member of the MimeTextMatchCollection at the specified zero-based index.
[C#] In C#, this property is the indexer for the MimeTextMatchCollection class.
[Visual Basic] Public Default Property Item( _ ByVal index As Integer _ ) As MimeTextMatch [C#] public MimeTextMatch this[ int index ] {get; set;} [C++] public: __property MimeTextMatch* get_Item( int index ); public: __property void set_Item( int index, MimeTextMatch* ); [JScript] returnValue = MimeTextMatchCollectionObject.Item(index); MimeTextMatchCollectionObject.Item(index) = returnValue; -or- returnValue = MimeTextMatchCollectionObject(index); MimeTextMatchCollectionObject(index) = returnValue;
[JScript] In JScript, you can use the default indexed properties defined by a type, but you cannot explicitly define your own. However, specifying the expando attribute on a class automatically provides a default indexed property whose type is Object and whose index type is String.
Arguments [JScript]
- index
- The zero-based index of the MimeTextMatch whose value is returned or modified.
Parameters [Visual Basic, C#, C++]
- index
- The zero-based index of the MimeTextMatch whose value is returned or modified.
Property Value
A MimeTextMatch.
Example
[Visual Basic, C#, C++] The following example demonstrates the use of a zero-based index to retrieve a member of the MimeTextMatchCollection.
[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