Reputation: 255
I've got some java codes like this:
ByteBuffer buffer = ByteBuffer.allocate(length * 2);
buffer.order(java.nio.ByteOrder.LITTLE_ENDIAN);
for (short s : data)
buffer.putShort(s);
How to convert it to C#
code?
basically, I don't know the how to work
buffer.order(java.nio.ByteOrder.LITTLE_ENDIAN);
out in C#
.
Any help is appreciate!
Upvotes: 1
Views: 1150
Reputation: 2054
Probably a good place to start looking would be the msdn library docs specifically the System.Convert
class can be used to convert value types to raw bytes and back again.
It looks like this question may help you as well:
Is .NET BinaryReader always little-endian, even on big-endian systems?
Upvotes: 1