Example of c determining the correct ip address format
- 2020-06-15 10:06:02
- OfStack
To determine whether the ip address is correct, use the.Net ready-made class as follows
string ipStr="192.168.222.333";
IPAddress ip;
if(IPAddress.TryParse(ipStr,out ip))
{
Console.WriterLine(" legal IP");
}
else
{
Console.WriterLine(" illegal IP");
}