共用方式為


MimeMultipartRelatedBinding 類別

定義

表示已加入至 InputBindingOutputBinding 的擴充性項目,將個別 MIME 格式指定給 HTTP 傳輸的各部分。 此類別無法獲得繼承。

public ref class MimeMultipartRelatedBinding sealed : System::Web::Services::Description::ServiceDescriptionFormatExtension
[System.Web.Services.Configuration.XmlFormatExtension("multipartRelated", "http://schemas.xmlsoap.org/wsdl/mime/", typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))]
public sealed class MimeMultipartRelatedBinding : System.Web.Services.Description.ServiceDescriptionFormatExtension
[<System.Web.Services.Configuration.XmlFormatExtension("multipartRelated", "http://schemas.xmlsoap.org/wsdl/mime/", typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))>]
type MimeMultipartRelatedBinding = class
    inherit ServiceDescriptionFormatExtension
Public NotInheritable Class MimeMultipartRelatedBinding
Inherits ServiceDescriptionFormatExtension
繼承
MimeMultipartRelatedBinding
屬性

範例

下列範例示範如何使用 類別所 MimeMultipartRelatedBinding 公開的屬性和方法。

#using <System.dll>
#using <System.Web.Services.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;

int main()
{
   ServiceDescription^ myServicDescription = ServiceDescription::Read( "MimeMultiPartRelatedSample_cpp.wsdl" );

   // Get the binding collection.
   BindingCollection^ myBindingCollection = myServicDescription->Bindings;
   int index = 0;
   for ( int i = 0; i < myBindingCollection->Count; i++ )
      // Get the collection for MimeServiceHttpPost.
      if ( String::Compare( myBindingCollection[ i ]->Name, "MimeServiceHttpPost" ) == 0 )
      {
         OperationBindingCollection^ myOperationBindingCollection = myBindingCollection[ i ]->Operations;
         OutputBinding^ myOutputBinding = myOperationBindingCollection[ 0 ]->Output;
         ServiceDescriptionFormatExtensionCollection ^ myServiceDescriptionFormatExtensionCollection = myOutputBinding->Extensions;
         MimeMultipartRelatedBinding^ myMimeMultipartRelatedBinding = dynamic_cast<MimeMultipartRelatedBinding^>(myServiceDescriptionFormatExtensionCollection->Find( MimeMultipartRelatedBinding::typeid ));
         MimePartCollection^ myMimePartCollection = myMimeMultipartRelatedBinding->Parts;
         IEnumerator^ myEnum = myMimePartCollection->GetEnumerator();
         while ( myEnum->MoveNext() )
         {
            MimePart^ myMimePart = dynamic_cast<MimePart^>(myEnum->Current);
            Console::WriteLine( "Extension Types added to MimePart: {0}", index++ );
            Console::WriteLine( "----------------------------" );
            IEnumerator^ myEnum2 = myMimePart->Extensions->GetEnumerator();
            while ( myEnum2->MoveNext() )
            {
               Console::WriteLine( myEnum2->Current->GetType() );
            }

            Console::WriteLine( "" );
         }

         break;
      }
}
using System;
using System.Web.Services.Description;

namespace MimeContentBinding_work
{
   class MyMimeContentClass
   {
      static void Main()
      {
         ServiceDescription  myServicDescription =
            ServiceDescription.Read("MimeMultiPartRelatedSample_cs.wsdl");

         // Get the binding collection.
         BindingCollection myBindingCollection = myServicDescription.Bindings;
         int index =0;
         for (int i= 0; i < myBindingCollection.Count;i++)
         {
            // Get the collection for MimeServiceHttpPost.
            if( myBindingCollection[i].Name == "MimeServiceHttpPost")
            {
               OperationBindingCollection myOperationBindingCollection =
                  myBindingCollection[i].Operations;
               OutputBinding myOutputBinding =
                  myOperationBindingCollection[0].Output;
               ServiceDescriptionFormatExtensionCollection
                  myServiceDescriptionFormatExtensionCollection =
                  myOutputBinding.Extensions;
               MimeMultipartRelatedBinding myMimeMultipartRelatedBinding  =
                  (MimeMultipartRelatedBinding)
                  myServiceDescriptionFormatExtensionCollection.Find(
                  typeof(MimeMultipartRelatedBinding));
               MimePartCollection myMimePartCollection =
                  myMimeMultipartRelatedBinding.Parts;
               foreach( MimePart myMimePart in myMimePartCollection)
               {
                  Console.WriteLine("Extension types added to MimePart: " +
                     index ++);
                  Console.WriteLine ("----------------------------");
                  foreach(object myExtension in myMimePart.Extensions)
                     Console.WriteLine(myExtension.GetType());
                  Console.WriteLine();
               }
               break;
            }
         }
      }
   }
}
Imports System.Web.Services.Description

Namespace MimeContentBinding_work
    
   Class MyMimeContentClass
      
      Shared Sub Main()
        Dim myServicDescription As ServiceDescription = _
            ServiceDescription.Read("MimeMultiPartRelatedSample_vb.wsdl")

        ' Get the binding collection.
         Dim myBindingCollection As BindingCollection = _
            myServicDescription.Bindings
         Dim index As Integer = 0
         Dim i As Integer
         For i = 0 To myBindingCollection.Count - 1
            ' Get the collection for MimeServiceHttpPost.
            If myBindingCollection(i).Name = "MimeServiceHttpPost" Then
               Dim myOperationBindingCollection As _
                  OperationBindingCollection = myBindingCollection(i).Operations
               Dim myOutputBinding As OutputBinding = _
                  myOperationBindingCollection(0).Output
               Dim myServiceDescriptionFormatExtensionCollection As _
                  ServiceDescriptionFormatExtensionCollection = _
                  myOutputBinding.Extensions
               Dim myMimeMultipartRelatedBinding As _
                  MimeMultipartRelatedBinding = _ 
                  CType(myServiceDescriptionFormatExtensionCollection.Find( _
                  GetType(MimeMultipartRelatedBinding)), _
                  MimeMultipartRelatedBinding)
               Dim myMimePartCollection As MimePartCollection = _
                  myMimeMultipartRelatedBinding.Parts
               Dim myMimePart As MimePart
               For Each myMimePart In  myMimePartCollection
                  Console.WriteLine("Extension Types added to MimePart: " & _
                     index.ToString()) 
                  Console.WriteLine("----------------------------")
                  index = index + 1
                  Dim myExtension As Object
                  For Each myExtension In myMimePart.Extensions
                     Console.WriteLine(myExtension.GetType())
                  Next myExtension
                  Console.WriteLine()
               Next myMimePart
               Exit For
            End If
         Next i
      End Sub
   End Class
End Namespace 'MimeContentBinding_work

備註

如需指定 XML Web 服務的通訊協議的詳細資訊,請參閱 使用 ASP.NET 的 XML Web 服務。 如需 Web 服務描述語言 (WSDL) 的詳細資訊,請參閱 WSDL 規格。

建構函式

MimeMultipartRelatedBinding()

初始化 MimeMultipartRelatedBinding 類別的新執行個體。

屬性

Handled

取得或設定值,指出 ServiceDescriptionFormatExtension 是否在擴充性項目匯入時由匯入處理序來使用。

(繼承來源 ServiceDescriptionFormatExtension)
Parent

取得 ServiceDescriptionFormatExtension 的父系。

(繼承來源 ServiceDescriptionFormatExtension)
Parts

取得已加入至 MimeMultipartRelatedBinding 的擴充性項目集合,以便將 MIME 格式指定給 MIME 訊息的各部分。

Required

取得或設定值,指出 ServiceDescriptionFormatExtension 對它所參考的動作是否是必要的。

(繼承來源 ServiceDescriptionFormatExtension)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於