Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

MimeTextMatchCollection Class

Provides a collection of instances of the MimeTextMatch class. This class cannot be inherited.

Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)
public sealed class MimeTextMatchCollection : CollectionBase
public final class MimeTextMatchCollection extends CollectionBase
public final class MimeTextMatchCollection extends CollectionBase
Not applicable.

A MimeTextMatch represents a MIME text pattern for which an HTTP transmission will be searched. For more information about specifying protocols for XML Web services, see XML Web Services Using ASP.NET. For more information about Web Services Description Language (WSDL), see the specification at http://www.w3.org/TR/wsdl/.

The following example demonstrates the use of the properties and methods exposed by the MimeTextMatchCollection class.

// 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.
InputBinding myInputBinding = new InputBinding();
MimeTextBinding myMimeTextBinding = new MimeTextBinding();
MimeTextMatchCollection myMimeTextMatchCollection;

// Get an array instance of 'MimeTextMatch' class.
MimeTextMatch myMimeTextMatch[] = new MimeTextMatch[4];
myMimeTextMatchCollection = myMimeTextBinding.get_Matches();

// Initialize properties of 'MimeTextMatch' class.
for (myInt = 0; myInt < 4; myInt++) {
    // Create the 'MimeTextMatch' instance.
    myMimeTextMatch.set_Item(myInt, new MimeTextMatch());
    ((MimeTextMatch)myMimeTextMatch.get_Item(myInt)).
        set_Name("Title");
    ((MimeTextMatch)myMimeTextMatch.get_Item(myInt)).
        set_Type("*/*");
    ((MimeTextMatch)myMimeTextMatch.get_Item(myInt)).
        set_IgnoreCase(true);

    if (true == myMimeTextMatchCollection.
        Contains(myMimeTextMatch.get_Item(0))) {

        ((MimeTextMatch)myMimeTextMatch.get_Item(myInt)).
            set_Name("Title" + Convert.ToString(myInt));
        ((MimeTextMatch)myMimeTextMatch.get_Item(myInt)).
            set_Capture(2);
        ((MimeTextMatch)myMimeTextMatch.get_Item(myInt)).
            set_Group(2);
        myMimeTextMatchCollection.Add(myMimeTextMatch.
            get_Item(myInt));
    }
    else {
        myMimeTextMatchCollection.Add(myMimeTextMatch.
            get_Item(myInt));
        ((MimeTextMatch)myMimeTextMatchCollection.get_Item(myInt)).
            set_RepeatsString("2");
    }
}
myMimeTextMatchCollection = myMimeTextBinding.get_Matches();

// Copy collection to 'MimeTextMatch' array instance.
myMimeTextMatchCollection.CopyTo(myMimeTextMatch, 0);

myInputBinding.get_Extensions().Add(myMimeTextBinding);

// Add the 'InputBinding' to 'OperationBinding'.
myOperationBinding.set_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.get_Matches();
for (myInt = 0; myInt < 4; myInt++) {
    myMimeTextMatch1.set_Item(myInt, new MimeTextMatch());
    ((MimeTextMatch)myMimeTextMatch1.get_Item(myInt)).
        set_Name("Title" + Convert.ToString(myInt));

    if (myInt != 0) {
        ((MimeTextMatch)myMimeTextMatch1.get_Item(myInt)).
            set_RepeatsString("7");
    }
    myMimeTextMatchCollection1.Add(myMimeTextMatch1.get_Item(myInt));
}
myMimeTextMatch1.set_Item(4, new MimeTextMatch());

// Remove 'MimeTextMatch' instance from collection.
myMimeTextMatchCollection1.Remove(myMimeTextMatch1.get_Item(1));

// Using MimeTextMatchCollection.Item indexer to comapre. 
if (myMimeTextMatch1.get_Item(2).Equals(
    myMimeTextMatchCollection1.get_Item(1))) {

    // Check whether 'MimeTextMatch' instance exists. 
    myInt = myMimeTextMatchCollection1.
        IndexOf(myMimeTextMatch1.get_Item(2));

    // Insert 'MimeTextMatch' instance at a desired position.
    myMimeTextMatchCollection1.Insert(1, myMimeTextMatch1.
        get_Item(myInt));
    myMimeTextMatchCollection1.get_Item(1).set_RepeatsString("5");
    myMimeTextMatchCollection1.Insert(4, myMimeTextMatch1.
        get_Item(myInt));
}

System.Object
   System.Collections.CollectionBase
    System.Web.Services.Description.MimeTextMatchCollection
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.