How to select a specific range from an array of bytes

I cannot find any direct function (e.g. mybytearray.copy (offset, count)) that selects a range of bytes from an array of bytes. So, do I need to execute a loop to copy the necessary bytes?

+4
source share
3 answers

You can use Buffer.BlockCopy or Array.Copy .

+10
source

Depending on what you need, you can use LINQ. The syntax itself explains :)

 var newArr = currentArray.Skip(4).Take(300).ToArray(); 
+3
source

You can use Buffer.blockcopy. link here .

0
source

Source: https://habr.com/ru/post/1490722/


All Articles