本文整理匯總了C#中System.Net.IPAddress.HostToNetworkOrder方法的典型用法代碼示例。如果您正苦於以下問題:C# IPAddress.HostToNetworkOrder方法的具體用法?C# IPAddress.HostToNetworkOrder怎麽用?C# IPAddress.HostToNetworkOrder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Net.IPAddress
的用法示例。
在下文中一共展示了IPAddress.HostToNetworkOrder方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: IPAddress.HostToNetworkOrder()
//引入命名空間
using System;
using System.Net;
using System.Text;
class MainClass
{
public static void Main()
{
short test1 = 45;
int test2 = 314159;
long test3 = -123456789033452;
byte[] data = new byte[1024];
string output;
short test1b = IPAddress.HostToNetworkOrder(test1);
data = BitConverter.GetBytes(test1b);
output = BitConverter.ToString(data);
Console.WriteLine("test1 = {0}, nbo = {1}", test1b, output);
int test2b = IPAddress.HostToNetworkOrder(test2);
data = BitConverter.GetBytes(test2b);
output = BitConverter.ToString(data);
Console.WriteLine("test2 = {0}, nbo = {1}", test2b, output);
long test3b = IPAddress.HostToNetworkOrder(test3);
data = BitConverter.GetBytes(test3b);
output = BitConverter.ToString(data);
Console.WriteLine("test3 = {0}, nbo = {1}", test3b, output);
}
}