954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Convert double from Small Endian to Big Endian and vice versa

How do I convert double datatype from small endian to big endian and vice versa in c#. Your help will be highly appreciated.

Regards,
Sidharth Shah

sidharthrshah
Newbie Poster
3 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 
public static byte[] GetBigEndianBytesFromDouble(double value)
{
    byte[] b;
    b=BitConverter.GetBytes(value);
    if (BitConverter.IsLittleEndian)
        Array.Reverse(b);
    return b;
}
robertwharvey
Newbie Poster
1 post since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You