使用C#检查是否在Windows 7上启用了IPv6 [英] Checking if IPv6 is enabled on Windows 7 using C#

查看:55
本文介绍了使用C#检查是否在Windows 7上启用了IPv6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用C#编写程序来充当我公司的多功能工具.我们在此工具中想要做的一件事是确定是否在Windows 7计算机上启用了IPv6/将其绑定到了本地连接网络适配器.我不希望它有一个地址,只是想知道它是否在该适配器上启用或禁用.我不确定如何编写此代码.从我在网上可以找到的内容来看,似乎应该使用System.Net.Configuration和Ipv6Element来检查它是否已启用,但是我不知道如何对其进行编码.我希望能够在文本框中显示它是启用还是禁用,因此我猜测我将使用布尔值.有人可以为此指出正确的方向吗?谢谢!

I am trying to write a program using C# to act as a multipurpose tool for my company. One of the things we would like in this tool is to determine if IPv6 is enabled/binded to the local area connection network adapter on our Windows 7 machines. I'm not looking for it to have an address, just to know if it enabled or disabled on that adapter. I am unsure as to how to code this. From what I've been able to find online, it seems I should be using System.Net.Configuration and Ipv6Element to check if it is enabled, but I have no idea how to code it. I would like to be able to display if it is enabled or disabled in a text box, so I'm guessing I'd use Boolean values. Could someone point me in the right direction on this? Thanks!

推荐答案

您可以使用以下属性测试操作系统是否支持IPv6:

You can test whether the OS supports IPv6 by using this property:

bool supportsIpV6 = System.Net.Sockets.Socket.OSSupportsIPv6;

这篇关于使用C#检查是否在Windows 7上启用了IPv6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆