本文整理汇总了VB.NET中System.Web.Services.Description.MimePartCollection类的典型用法代码示例。如果您正苦于以下问题:VB.NET MimePartCollection类的具体用法?VB.NET MimePartCollection怎么用?VB.NET MimePartCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MimePartCollection类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MyMimePartCollection
' 导入命名空间
Imports System.Collections
Imports System.Xml
Imports System.Web.Services.Description
Public Class MyMimePartCollection
Public Shared Sub Main()
Dim myServiceDescription As ServiceDescription = ServiceDescription.Read _
("MimePartCollection_1_Input_vb.wsdl")
Dim myServiceDescriptionCol As New ServiceDescriptionCollection()
myServiceDescriptionCol.Add(myServiceDescription)
Dim myXmlQualifiedName As New XmlQualifiedName("MimeServiceHttpPost", "http://tempuri.org/")
' Create a 'Binding' object.
Dim myBinding As Binding = myServiceDescriptionCol.GetBinding(myXmlQualifiedName)
Dim myOperationBinding As OperationBinding = Nothing
Dim i As Integer
For i = 0 To myBinding.Operations.Count - 1
If myBinding.Operations(i).Name.Equals("AddNumbers") Then
myOperationBinding = myBinding.Operations(i)
End If
Next i
Dim myOutputBinding As OutputBinding = myOperationBinding.Output
Dim myMimeMultipartRelatedBinding As MimeMultipartRelatedBinding = Nothing
Dim myIEnumerator As IEnumerator = myOutputBinding.Extensions.GetEnumerator()
While myIEnumerator.MoveNext()
myMimeMultipartRelatedBinding = CType(myIEnumerator.Current, MimeMultipartRelatedBinding)
End While
' Create an instances of 'MimePartCollection'.
Dim myMimePartCollection As New MimePartCollection()
myMimePartCollection = myMimeMultipartRelatedBinding.Parts
Console.WriteLine("Total number of mimepart elements initially is: " + _
myMimePartCollection.Count.ToString())
' Create an instance of 'MimePart'.
Dim myMimePart As New MimePart()
' Create an instance of 'MimeXmlBinding'.
Dim myMimeXmlBinding As New MimeXmlBinding()
myMimeXmlBinding.Part = "body"
myMimePart.Extensions.Add(myMimeXmlBinding)
' Insert a mimepart at first position.
myMimePartCollection.Insert(0, myMimePart)
Console.WriteLine("Inserting a mimepart object...")
If myMimePartCollection.Contains(myMimePart) Then
Console.WriteLine("'MimePart' is succesffully added at position: " + _
myMimePartCollection.IndexOf(myMimePart).ToString())
Console.WriteLine("Total number of mimepart elements after inserting is: " + _
myMimePartCollection.Count.ToString())
End If
myServiceDescription.Write("MimePartCollection_1_Output_VB.wsdl")
Console.WriteLine("MimePartCollection_1_Output_VB.wsdl has been generated successfully.")
End Sub
End Class