Int64 - HostToNetworkOrder

Converts a long value from host byte order to network byte order.

Try it

public static void Main()
{
    Int64  input = 57;
	
	// C# Extension Method: Int64 - HostToNetworkOrder
	Int64  output = input.HostToNetworkOrder();
    Console.WriteLine("val = {0}, output = {1}", input, output);
}

View Source
using System;
using System.Net;

public static partial class Extensions
{
    /// <summary>
    ///     Converts a long value from host byte order to network byte order.
    /// </summary>
    /// <param name="host">The number to convert, expressed in host byte order.</param>
    /// <returns>A long value, expressed in network byte order.</returns>
    public static Int64 HostToNetworkOrder(this Int64 host)
    {
        return IPAddress.HostToNetworkOrder(host);
    }
}