?
Public Class SoapPackage
Public Property AttachmentName() As String
Get
Return m_AttachmentName
End Get
Set
m_AttachmentName = Value
End Set
End Property
Private m_AttachmentName As String
' put your file data in here
Public Property AttachmentData() As Byte()
Get
Return m_AttachmentData
End Get
Set
m_AttachmentData = Value
End Set
End Property
Private m_AttachmentData As Byte()
End Class
- ( , ):
Public Shared Function StreamToByteArray(input As Stream) As Byte()
Dim buffer As Byte() = New Byte(16 * 1024 - 1) {}
Using ms As New MemoryStream()
Dim read As Integer
While (InlineAssignHelper(read, input.Read(buffer, 0, buffer.Length))) > 0
ms.Write(buffer, 0, read)
End While
Return ms.ToArray()
End Using
End Function
:
, StreamToByteArray :
Dim filePath as String = "Path\to\file"
Dim fileBytes as Byte() = System.IO.File.ReadAllBytes(filePath)