MimeTextMatchCollection.Contains(MimeTextMatch) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回值,指出指定的 MimeTextMatch 是否為 MimeTextMatchCollection 的成員。
public:
bool Contains(System::Web::Services::Description::MimeTextMatch ^ match);
public bool Contains (System.Web.Services.Description.MimeTextMatch match);
member this.Contains : System.Web.Services.Description.MimeTextMatch -> bool
Public Function Contains (match As MimeTextMatch) As Boolean
參數
- match
- MimeTextMatch
MimeTextMatch,要為其檢查集合成員資格。
傳回
如果 match
參數是 MimeTextMatchCollection
的成員,則為 true
,否則為 false
。
範例
下列範例示範 Contains
方法的用法。
// Get an array instance of 'MimeTextMatch' class.
array<MimeTextMatch^>^myMimeTextMatch = gcnew array<MimeTextMatch^>(4);
myMimeTextMatchCollection = myMimeTextBinding->Matches;
// Initialize properties of 'MimeTextMatch' class.
for ( myInt = 0; myInt < 4; myInt++ )
{
// Create the 'MimeTextMatch' instance.
myMimeTextMatch[ myInt ] = gcnew MimeTextMatch;
myMimeTextMatch[ myInt ]->Name = "Title";
myMimeTextMatch[ myInt ]->Type = "*/*";
myMimeTextMatch[ myInt ]->IgnoreCase = true;
if ( true == myMimeTextMatchCollection->Contains( myMimeTextMatch[ 0 ] ) )
{
myMimeTextMatch[ myInt ]->Name = String::Format( "Title{0}", 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 );
// 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 );
' 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)