When I am entering the string "192" and it parses the string, it continues to return IPv4 even when it is not a valid IPv4 address. I tried adding an else if (someIP.GetAddressBytes().Length == 1) but it still returns IPv4.
IPAddress someIP = IPAddress.Parse("192");
if (someIP.GetAddressBytes().Length == 4)
{
Console.WriteLine("IPv4");
}
else if (someIP.GetAddressBytes().Length == 16)
{
Console.WriteLine("IPv6");
}
else
{
Console.WriteLine("Neither");
}