aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common/Net/IPHost.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2023-02-19 16:52:29 +0100
committerBond_009 <bond.009@outlook.com>2023-02-19 16:52:29 +0100
commit24a7e210c377bf828f21b5812f25c6545f7de006 (patch)
tree0476ae141a3bfc3d597d438a316f8c20bdfaa3c8 /MediaBrowser.Common/Net/IPHost.cs
parent1deb9f36ba5822249b8359e311635ea9001d5635 (diff)
Optimize tryparse
* Don't check for null before * Don't try different formats when not needed (NumberFormat.Integer is the fast path)
Diffstat (limited to 'MediaBrowser.Common/Net/IPHost.cs')
-rw-r--r--MediaBrowser.Common/Net/IPHost.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/MediaBrowser.Common/Net/IPHost.cs b/MediaBrowser.Common/Net/IPHost.cs
index 7cf1b8aa0..ec76a43b6 100644
--- a/MediaBrowser.Common/Net/IPHost.cs
+++ b/MediaBrowser.Common/Net/IPHost.cs
@@ -190,7 +190,7 @@ namespace MediaBrowser.Common.Net
/// <returns>Object representing the string, if it has successfully been parsed.</returns>
public static IPHost Parse(string host)
{
- if (!string.IsNullOrEmpty(host) && IPHost.TryParse(host, out IPHost res))
+ if (IPHost.TryParse(host, out IPHost res))
{
return res;
}
@@ -206,7 +206,7 @@ namespace MediaBrowser.Common.Net
/// <returns>Object representing the string, if it has successfully been parsed.</returns>
public static IPHost Parse(string host, AddressFamily family)
{
- if (!string.IsNullOrEmpty(host) && IPHost.TryParse(host, out IPHost res))
+ if (IPHost.TryParse(host, out IPHost res))
{
if (family == AddressFamily.InterNetwork)
{