// handles whitespace and ports (that must be part of dotnet) // https://github.com/dotnet/runtime/issues/45194 public static bool TryParse(string ipString, out IPAddress iPAddress) { ipString = ipString.Trim(); if (ipString.StartsWith("::ffff:")) { ipString = ipString.Remove(0, 7); } if (IPEndPoint.TryParse(ipString, out var ep)) { iPAddress = ep.Address; return(true); } iPAddress = null; return(false); }