InertiaM
Well-known member
I'm trying to create a file which includes a string, then a byte array, then a string. The following works :-
but is slightly inefficient as it uses 3 WriteAllBytes lines. What's the best way to comine these three byte arrays and then do just one WriteAllBytes line?
VB.NET:
Dim baFirstLine() As Byte = StrToByteArray("First line" & vbCrLf)
Dim jpgFile() As Byte = My.Computer.FileSystem.ReadAllBytes("c:\temp.jpg")
Dim baSecondLine() As Byte = StrToByteArray(vbCrLf & "Second line" & vbCrLf)
My.Computer.FileSystem.WriteAllBytes("c:\bytearray.bin", baFirstLine, False)
My.Computer.FileSystem.WriteAllBytes("c:\bytearray.bin", jpgFile, True)
My.Computer.FileSystem.WriteAllBytes("c:\bytearray.bin", baSecondLine, True)
but is slightly inefficient as it uses 3 WriteAllBytes lines. What's the best way to comine these three byte arrays and then do just one WriteAllBytes line?