473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Combine byte[]

TJO
What is the best way to combine two byte[]? I am not finding one yet.
Thanks
Nov 16 '05 #1
2 8178
Hi,

Look at Array.Copy() and Array.CopyTo() methods.

"TJO" <no@spam.com> wrote in message
news:uW**************@TK2MSFTNGP09.phx.gbl...
What is the best way to combine two byte[]? I am not finding one yet.
Thanks

Nov 16 '05 #2
What is the best way to combine two byte[]? I am not finding one yet.


Something like this:

byte[] Combine(byte[] a, byte[] b)
{
byte[] c = new byte[a.Length + b.Length];
System.Buffer.BlockCopy(a, 0, c, 0, a.Length);
System.Buffer.BlockCopy(b, 0, c, a.Length, b.Length);
return c;
}

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: kee | last post by:
Hi All, I am trying to figure out on how to combine 2 byte array and save to a file. e.g. open "image001.bmp" for binary access write as #1 put #1,,x() & y() close #1 notes : x() and y()...
24
by: trint | last post by:
add them into one PrintDocument: PrintDocument pd1 = new PrintDocument(); PrintDocument pd2 = new PrintDocument(); PrintDocument pdCombined = new PrintDocument(); pdCombined = pd1 + pd2;...
8
by: frekster | last post by:
Hi. I used to be able to do this easily in vb 6 via looping and preserving the source array data/size etc. How can I do this in vb.net? I've been trying for a while now and this should be...
12
by: Mark Rae | last post by:
Hi, Can anyone please tell me how to convert an unserializeable object say, a System.Web.Mail.MailMessage object, to a byte array and then convert the byte array to a Base64 string? Any...
9
by: Nikolay Petrov | last post by:
I have a couple of byte arrays. What is the most efficient way to combine them? After combining they will go in a network stream. thanks
3
by: Vinny Vinn | last post by:
What is the simplest way to combine one byte with another? for example if i have byte header = Encoding.ASCII.GetBytes("this is the header"); and byte body = Encoding.ASCII.GetBytes("this is the...
2
by: chris | last post by:
I have a few byte arrays that I would like to combine into one array (order needs to be kept). What would be the most efficient way to do this? Thanks for your time, Chris
3
by: =?Utf-8?B?U1MgbWFkaHU=?= | last post by:
Hi, I have two word files. listprice.doc,product.doc I converted each of the documents into bytes byte bytedata - lisprice.doc byte bytedata1-product.doc I create a new array and copy both...
1
Krantor
by: Krantor | last post by:
Hi all, i am quite new to c# and was wondering if i could get assistance on an issue im having with writing a binary file from the database to my local machine, this is the code i have: string...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.