C# 判断是否为IP地址

string ipStr="172.27.190.117";
IPAddress ip;
if(IPAddress.TryParse(ipStr,out ip))
{
    MessageBox.Show("合法IP");
}
else
{
   MessageBox.Show("非IP");
}

posted @ 2016-08-31 16:25  旗木卡卡赵赵  阅读(2782)  评论(0编辑  收藏  举报