Skip to content

Commit b892995

Browse files
.
1 parent 62e30b6 commit b892995

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

roles/lib/files/FWO.Basics/IpOperations.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,9 @@ public static bool TryParseIPString<T>(this string ipString, out T? ipResult, bo
141141
private static bool IsValidIPv4(string ipAddress)
142142
{
143143
byte[] addBytes = [.. ipAddress.Split('.').Where(_ => byte.Parse(_) <= 255 && byte.Parse(_) >= 0).Select(byte.Parse)];
144-
if(addBytes.Length != 4) return false;
145-
foreach(var b in addBytes)
146-
{
147-
if(b < 0 || b > 255) return false;
148-
}
149-
return true;
144+
145+
return addBytes.Length != 4;
146+
150147
}
151148

152149
public static string GetObjectType(string ip1, string ip2)

0 commit comments

Comments
 (0)