博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C# 获取网卡IP地址
阅读量:4512 次
发布时间:2019-06-08

本文共 666 字,大约阅读时间需要 2 分钟。

NetworkInterface[] NetworkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface NetworkIntf in NetworkInterfaces)
{
    IPInterfaceProperties IPInterfaceProperties = NetworkIntf.GetIPProperties();
    UnicastIPAddressInformationCollection UnicastIPAddressInformationCollection = IPInterfaceProperties.UnicastAddresses;
    foreach (UnicastIPAddressInformation UnicastIPAddressInformation in UnicastIPAddressInformationCollection)
    {
        if (UnicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork)
        {
            Console.WriteLine(UnicastIPAddressInformation.Address);
        }
    }
}

转载于:https://www.cnblogs.com/MaxWoods/archive/2008/04/07/1140458.html

你可能感兴趣的文章
7.分类:基本概念 忌讳
查看>>
PIL Image 转成 wx.Image、wx.Bitmap
查看>>
名词解释
查看>>
确保某值在区间内
查看>>
递归in C++
查看>>
整合wordpress的插件!!
查看>>
A - LCM Challenge
查看>>
书籍整理
查看>>
arttemplate模板引擎有假数据返回数据多层内嵌的渲染方法
查看>>
APP为什么会被打回来??
查看>>
word中图片不显示了
查看>>
Chap-3 Section 3.1 目标文件格式
查看>>
用NSSM把.Net Core部署至 Windows 服务
查看>>
CentOS6.5 一键部署运行环境shell脚本
查看>>
springMVC 报错:Unknown return value type: java.lang.Integer
查看>>
jquery easyui 验证Combo和ComboBox
查看>>
Looper,MessageQueue,Message,Handler
查看>>
编程珠玑--变位词集合
查看>>
Centos7 忘记密码的情况下,修改root密码
查看>>
第九章:testng——在Android Eclipse ADT 中 在线安装步骤
查看>>