/// <summary>Converts an integer value from network byte order to host byte order.</summary> /// <returns>An integer value, expressed in host byte order.</returns> /// <param name="network">The number to convert, expressed in network byte order. </param> public static int NetworkToHostOrder(int network) { if (!BitConverter.IsLittleEndian) { return(network); } return(IPAddress.SwapInt(network)); }
/// <summary>Converts an integer value from host byte order to network byte order.</summary> /// <returns>An integer value, expressed in network byte order.</returns> /// <param name="host">The number to convert, expressed in host byte order. </param> public static int HostToNetworkOrder(int host) { if (!BitConverter.IsLittleEndian) { return(host); } return(IPAddress.SwapInt(host)); }