Q:

Can I create a new array reference which contains a subset of an existing array, without copying memory?

I am building a file reader in C#, and large volumes of data will be enumerated.  I want to use the same buffer for each element I read out, then pass the buffer on for further processing by the client.  The API would be cleaner if I could return a byte[] of the correct size, rather than the raw buffer and a length.
Is it possible to do this in C# without copying memory?

A:

You can use ArraySegment<T>
http://msdn.microsoft.com/en-us/library/1hsbd92d.aspx
That lets you specify the start and end of the segment you want to pass on without copying any data.

A:

If you can change your API parameter types, I think you could use an ArraySegment.

