mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-15 10:43:30 +01:00
Optimize tryparse
* Don't check for null before * Don't try different formats when not needed (NumberFormat.Integer is the fast path)
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user