1.前言用簡單的方法取得本機電腦的主機名稱。 2.說明 using System.Net; private void button1_Click(object sender, EventArgs e) { MessageBox.Show(Dns.GetHostName()); }