简体   繁体   English

从VB.NET中的字节数组中获取四个字节

[英]Getting four bytes from a byte array in VB.NET

I have a byte array, and I need to get four bytes from it at a certain location (16), but I don't want to convert it to an integer or anything. 我有一个字节数组,我需要从某个位置获取四个字节(16),但我不想将它转换为整数或任何东西。 Just keep it as four bytes to store in a variable. 只需将其保存为四个字节即可存储在变量中。

If you have say: 如果你说:

byte[] source; // source array
byte[] dest=new byte[4];

Then you'd copy 4 bytes from source starting at 16 to dest like this: 然后你将从16开始的source复制4个字节到这样的dest

Array.Copy(source, 16, dest, 0, 4);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM