Reverse Bytes for Network - CSharp System

CSharp examples for System:Byte

Description

Reverse Bytes for Network

Demo Code


using System.Net;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*w  w w .ja va2s . c o m*/

public class Main{
        public static long ReverseBytes(long value)
        {
            return IPAddress.NetworkToHostOrder(value);
        }
        public static int ReverseBytes(int value)
        {
            return IPAddress.NetworkToHostOrder(value);
        }
        public static short ReverseBytes(short value)
        {
            return IPAddress.NetworkToHostOrder(value);
        }
}

Related Tutorials