MimeTextMatchCollection 类

定义

提供 MimeTextMatch 类的实例集合。 此类不能被继承。

public ref class MimeTextMatchCollection sealed : System::Collections::CollectionBase
public sealed class MimeTextMatchCollection : System.Collections.CollectionBase
type MimeTextMatchCollection = class
    inherit CollectionBase
Public NotInheritable Class MimeTextMatchCollection
Inherits CollectionBase
继承
MimeTextMatchCollection

示例

下面的示例演示如何使用 类 MimeTextMatchCollection 公开的属性和方法。

// Create the 'InputBinding' object.
InputBinding^ myInputBinding = gcnew InputBinding;
MimeTextBinding^ myMimeTextBinding = gcnew MimeTextBinding;
MimeTextMatchCollection^ myMimeTextMatchCollection;

// 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 );

myInputBinding->Extensions->Add( myMimeTextBinding );

// Add the 'InputBinding' to 'OperationBinding'.
myOperationBinding->Input = myInputBinding;

// Create the 'OutputBinding' instance.
OutputBinding^ myOutputBinding = gcnew OutputBinding;

// Create the 'MimeTextBinding' instance.
MimeTextBinding^ myMimeTextBinding1 = gcnew MimeTextBinding;

// Get an instance of 'MimeTextMatchCollection'.
MimeTextMatchCollection^ myMimeTextMatchCollection1 = gcnew MimeTextMatchCollection;
array<MimeTextMatch^>^myMimeTextMatch1 = gcnew array<MimeTextMatch^>(5);
myMimeTextMatchCollection1 = myMimeTextBinding1->Matches;
for ( myInt = 0; myInt < 4; myInt++ )
{
   myMimeTextMatch1[ myInt ] = gcnew MimeTextMatch;
   myMimeTextMatch1[ myInt ]->Name = String::Format( "Title{0}", Convert::ToString( myInt ) );
   if ( myInt != 0 )
   {
      myMimeTextMatch1[ myInt ]->RepeatsString = "7";
   }
   myMimeTextMatchCollection1->Add( myMimeTextMatch1[ myInt ] );
}
myMimeTextMatch1[ 4 ] = gcnew 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 ] );
}
// Create the 'InputBinding' object.
InputBinding myInputBinding = new InputBinding();
MimeTextBinding myMimeTextBinding = new MimeTextBinding();
MimeTextMatchCollection myMimeTextMatchCollection;
// 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 );
myInputBinding.Extensions.Add(myMimeTextBinding);
// Add the 'InputBinding' to 'OperationBinding'.
myOperationBinding.Input = myInputBinding;

// Create the 'OutputBinding' instance.
OutputBinding myOutputBinding = new OutputBinding();
// Create the 'MimeTextBinding' instance.
MimeTextBinding myMimeTextBinding1 = new MimeTextBinding();
// 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 ] );
}
' Create the 'InputBinding' object.
Dim myInputBinding As New InputBinding()
Dim myMimeTextBinding As New MimeTextBinding()
Dim myMimeTextMatchCollection As MimeTextMatchCollection
' 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)
myInputBinding.Extensions.Add(myMimeTextBinding)
' Add the 'InputBinding' to 'OperationBinding'.
myOperationBinding.Input = myInputBinding

' Create the 'OutputBinding' instance.
Dim myOutputBinding As New OutputBinding()
' Create the 'MimeTextBinding' instance.
Dim myMimeTextBinding1 As New MimeTextBinding()
' 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

注解

表示 MimeTextMatch 将为其搜索 HTTP 传输的 MIME 文本模式。 有关为 XML Web 服务指定协议的详细信息,请参阅 XML Web Services Using ASP.NET。 有关 Web 服务描述语言 (WSDL) 的详细信息,请参阅 WSDL 规范。

构造函数

MimeTextMatchCollection()

初始化 MimeTextMatchCollection 类的新实例。

属性

Capacity

获取或设置 CollectionBase 可包含的元素数。

(继承自 CollectionBase)
Count

获取 CollectionBase 实例中包含的元素数。 不能重写此属性。

(继承自 CollectionBase)
InnerList

获取一个 ArrayList,它包含 CollectionBase 实例中元素的列表。

(继承自 CollectionBase)
Item[Int32]

获取或设置位于指定的从零开始的索引处的 MimeTextMatchCollection 的成员的值。

List

获取一个 IList,它包含 CollectionBase 实例中元素的列表。

(继承自 CollectionBase)

方法

Add(MimeTextMatch)

将指定的 MimeTextMatch 添加到 MimeTextMatchCollection 的结尾。

Clear()

CollectionBase 实例移除所有对象。 不能重写此方法。

(继承自 CollectionBase)
Contains(MimeTextMatch)

返回一个值,该值指示指定的 MimeTextMatch 是否是 MimeTextMatchCollection 的成员。

CopyTo(MimeTextMatch[], Int32)

将整个 MimeTextMatchCollection 复制到兼容的、MimeTextMatch 类型的一维数组(从目标数组的指定的从零开始的索引处开始复制)。

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetEnumerator()

返回循环访问 CollectionBase 实例的枚举器。

(继承自 CollectionBase)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
IndexOf(MimeTextMatch)

搜索指定的 MimeTextMatch,并返回集合中第一个匹配项的索引(从零开始)。

Insert(Int32, MimeTextMatch)

将指定的 MimeTextMatch 添加到 MimeTextMatchCollection 中的指定索引处。

MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
OnClear()

清除 CollectionBase 实例的内容时执行其他自定义进程。

(继承自 CollectionBase)
OnClearComplete()

在清除 CollectionBase 实例的内容之后执行其他自定义进程。

(继承自 CollectionBase)
OnInsert(Int32, Object)

在向 CollectionBase 实例中插入新元素之前执行其他自定义进程。

(继承自 CollectionBase)
OnInsertComplete(Int32, Object)

在向 CollectionBase 实例中插入新元素之后执行其他自定义进程。

(继承自 CollectionBase)
OnRemove(Int32, Object)

当从 CollectionBase 实例移除元素时执行其他自定义进程。

(继承自 CollectionBase)
OnRemoveComplete(Int32, Object)

在从 CollectionBase 实例中移除元素之后执行其他自定义进程。

(继承自 CollectionBase)
OnSet(Int32, Object, Object)

当在 CollectionBase 实例中设置值之前执行其他自定义进程。

(继承自 CollectionBase)
OnSetComplete(Int32, Object, Object)

当在 CollectionBase 实例中设置值后执行其他自定义进程。

(继承自 CollectionBase)
OnValidate(Object)

当验证值时执行其他自定义进程。

(继承自 CollectionBase)
Remove(MimeTextMatch)

MimeTextMatch 中移除指定的 MimeTextMatchCollection 的第一个匹配项。

RemoveAt(Int32)

移除 CollectionBase 实例的指定索引处的元素。 此方法不可重写。

(继承自 CollectionBase)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

显式接口实现

ICollection.CopyTo(Array, Int32)

从目标数组的指定索引处开始将整个 CollectionBase 复制到兼容的一维 Array

(继承自 CollectionBase)
ICollection.IsSynchronized

获取一个值,该值指示是否同步对 CollectionBase 的访问(线程安全)。

(继承自 CollectionBase)
ICollection.SyncRoot

获取可用于同步对 CollectionBase 的访问的对象。

(继承自 CollectionBase)
IList.Add(Object)

将对象添加到 CollectionBase 的结尾处。

(继承自 CollectionBase)
IList.Contains(Object)

确定 CollectionBase 是否包含特定元素。

(继承自 CollectionBase)
IList.IndexOf(Object)

搜索指定的 Object,并返回整个 CollectionBase 中第一个匹配项的从零开始的索引。

(继承自 CollectionBase)
IList.Insert(Int32, Object)

将元素插入 CollectionBase 的指定索引处。

(继承自 CollectionBase)
IList.IsFixedSize

获取一个值,该值指示 CollectionBase 是否具有固定大小。

(继承自 CollectionBase)
IList.IsReadOnly

获取一个值,该值指示 CollectionBase 是否为只读。

(继承自 CollectionBase)
IList.Item[Int32]

获取或设置指定索引处的元素。

(继承自 CollectionBase)
IList.Remove(Object)

CollectionBase 中移除特定对象的第一个匹配项。

(继承自 CollectionBase)

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。

AsParallel(IEnumerable)

启用查询的并行化。

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryable

适用于