获取本地计算机的主机名

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;   //需引用该命名空间

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            string hostName = Dns.GetHostName();
            Console.WriteLine("Computer name: " + hostName);
            Console.Read();

        }
    }
}
发布了36 篇原创文章 · 获赞 0 · 访问量 1904

猜你喜欢

转载自blog.csdn.net/qq_29761395/article/details/50216777