Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim data1 As Byte() = System.Text.Encoding.Unicode.GetBytes("1234")
Dim data2 As Byte() = System.Text.Encoding.Unicode.GetBytes("6789")
Dim data3 = New Byte(data1.Length + (data2.Length - 1)) {}
Dim s As IO.Stream = New IO.MemoryStream()
s.Write(data1, 0, data1.Length)
s.Write(data2, 0, data2.Length)
s.Position = 0
Dim r As Integer = s.Read(data3, 0, data3.Length)
'此时data3中就是合并的值了
If r > 0 Then
MsgBox(System.Text.Encoding.Unicode.GetString(data3))
End If
End Sub
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim data1 As Byte() = System.Text.Encoding.Unicode.GetBytes("1234")
Dim data2 As Byte() = System.Text.Encoding.Unicode.GetBytes("6789")
Dim data3 = New Byte(data1.Length + (data2.Length - 1)) {}
Dim s As IO.Stream = New IO.MemoryStream()
s.Write(data1, 0, data1.Length)
s.Write(data2, 0, data2.Length)
s.Position = 0
Dim r As Integer = s.Read(data3, 0, data3.Length)
'此时data3中就是合并的值了
If r > 0 Then
MsgBox(System.Text.Encoding.Unicode.GetString(data3))
End If
End Sub
End Class
【VB.net Byte数组和并.rar】点击下载此文件
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |