Well, something close would be to use Buffer.BlockCopy :
uint[] decoded = new uint[target.Length / 4]; Buffer.BlockCopy(target, 0, decoded, 0, target.Length);
Note that the final argument to BlockCopy is always the number of copies, regardless of the types you copy.
You can't just treat the byte array as a uint array in C # (at least not in safe code, I don't know about unsafe code), but Buffer.BlockCopy will map the contents of the byte array to the uint array ... leaving the results to determine based on the essence of the system. Personally, I am not a fan of this approach - it leaves the code quite error prone when switching to a system with a different memory mask. I prefer to be explicit in my protocol. Hope this helps you in this case.
source share