Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

--Using [VS C#.NET]--

 

Given a byte array of size 64 (baBuff[64]), this is used as a buffer to store incomming data.

Most of the time the buffers capacity is not completly used, however I know the exact length of valid data in the buffer [int DataPointer = length of valid Data]

 

Thing is I am trying to copy the valid data in my baBuff into a larger byte[] message I am creating, I don't want to be stuck coping over the entire 64bytes everytime.

Currently I am using the following code:

 

:: CODE ::

 

byte[] baTemp = new byte[DataPointer];

for (int i=0; i<nLen; i++)

{

baTemp = baBuff;

}

 

// Load Raw Data

baBuff.CopyTo(baData, 5);

 

 

Is there a better way to do this? Can I access the byte[] using something like substring?

There has to be a nicer method... any clues?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...