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

public static byte[] GetBigEndianBytesFromDouble(double value)
{
    byte[] b;
    b=BitConverter.GetBytes(value);
    if (BitConverter.IsLittleEndian)
        Array.Reverse(b);
    return b;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.