本文整理汇总了C#中System.Net.IPAddress.Count方法的典型用法代码示例。如果您正苦于以下问题:C# IPAddress.Count方法的具体用法?C# IPAddress.Count怎么用?C# IPAddress.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.IPAddress
的用法示例。
在下文中一共展示了IPAddress.Count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IpAddressesForm
public IpAddressesForm(IPAddress[] addresses)
{
InitializeComponent();
string message = $"This domain has {addresses.Count()} IP Addresses associated with it.\r\n";
foreach(var address in addresses)
{
message += address.ToString() + "\r\n";
}
uiIpAddressesTextBox.Text = message;
}
示例2: getIPv4Address
/// <summary>
/// Select the first IPv4Address in the given ipaddresses
/// </summary>
/// <param name="_addresses">The ipaddresses from which the method will select the first IPv4Address</param>
/// <returns></returns>
private IPAddress getIPv4Address(IPAddress[] _addresses)
{
Int32 i = new Int32();
// while no IPv4Address is found
while (i != _addresses.Count() && _addresses[i].AddressFamily != AddressFamily.InterNetwork)
{
i++;
}
// if no IPv4Address has been foudn
if (i == _addresses.Count())
return null;
// return the selected IPv4Address
return _addresses[i];
}