⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipandname.cs

📁 Csharp实例编程百例.rar
💻 CS
字号:
using System;
using System.Net;
class IpAndName
{
	static void Main(string[] args)
	{
		DnsPermission DnsP=new DnsPermission(System.Security.Permissions.PermissionState.Unrestricted);
		DnsP.IsUnrestricted();
		string ComputerName=Dns.GetHostName();
		IPHostEntry myHost=new IPHostEntry();
		myHost=Dns.Resolve(ComputerName);
		//myHost=Dns.GetHostByName(ComputerName);
		Console.WriteLine("The name of this computer is : {0}",ComputerName);
		Console.WriteLine("The IP of this computer is:");
		for(int i=0;i<myHost.AddressList.Length;i++)
		{
			Console.WriteLine("{0}",myHost.AddressList[i].ToString());
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -