diff options
| author | Bond_009 <bond.009@outlook.com> | 2023-02-19 16:52:29 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2023-02-19 16:52:29 +0100 |
| commit | 24a7e210c377bf828f21b5812f25c6545f7de006 (patch) | |
| tree | 0476ae141a3bfc3d597d438a316f8c20bdfaa3c8 /MediaBrowser.Model/Dlna/ConditionProcessor.cs | |
| parent | 1deb9f36ba5822249b8359e311635ea9001d5635 (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.Model/Dlna/ConditionProcessor.cs')
| -rw-r--r-- | MediaBrowser.Model/Dlna/ConditionProcessor.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs index 573422416..00b406bbe 100644 --- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs +++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs @@ -136,7 +136,7 @@ namespace MediaBrowser.Model.Dlna return !condition.IsRequired; } - if (int.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var expected)) + if (int.TryParse(condition.Value, CultureInfo.InvariantCulture, out var expected)) { switch (condition.Condition) { @@ -212,7 +212,7 @@ namespace MediaBrowser.Model.Dlna return !condition.IsRequired; } - if (double.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var expected)) + if (double.TryParse(condition.Value, CultureInfo.InvariantCulture, out var expected)) { switch (condition.Condition) { |
