views:

395

answers:

1

I have a byte array of some binary data that i need to send over the network using WCF and NetTcpBinding. My problem is that i need to send only the part of the array. Is there any way to do this, other than copying that part to a separate array, and sending that one. This extra copying degrades performance, and i would like to avoid it, if possible.

A: 

In all likelihood, the performance hit of the copy operation will be negligible in the context of a WCF call.

Use Array.Copy which seems to perform really well.

d91-jal
I was wondering how WCF sends List<byte>, for example. List<byte> internally holds an array of bytes. Does it send the whole byte array or just the number of bytes actually used in the list (capacity or count). I need something like that.
nikola
You are not going to gain performance by using a more abstract collection class - it will still need to do array copy operations internally.
d91-jal