string mac =null;
/// <summary>
/// 获取MAC地址
/// </summary>
/// <returns>mac地址</returns>
public ReadMac()//获取本机MAC地址
{
ManagementClass mc;
mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
if (mo["IPEnabled"].ToString() == "True")
mac = mo["MacAddress"].ToString();
}
}
/// <summary>
/// mac地址转换成base64字符
/// </summary>
/// <param name="mac">原始mac地址</param>
/// <returns>转换后的mac地址</returns>
public string ChangeMac()
{
if (mac != null)
{
stri
Mac地址的读取(包括base64的转换)
最新推荐文章于 2023-12-17 07:26:56 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)