From 483dccc5d2af3fc0a4dd942caa59eca8ceb8f2ab Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Wed, 31 Mar 2021 19:53:59 +0800 Subject: [PATCH] trim --- Netch/Models/ParameterBase.cs | 3 +-- Netch/Utils/Utils.cs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Netch/Models/ParameterBase.cs b/Netch/Models/ParameterBase.cs index 4ecbb2a5..52d2e06f 100644 --- a/Netch/Models/ParameterBase.cs +++ b/Netch/Models/ParameterBase.cs @@ -1,7 +1,6 @@ using System; using System.Linq; using System.Reflection; -using Netch.Utils; namespace Netch.Models { @@ -49,7 +48,7 @@ namespace Netch.Models case bool b: return b ? $"{prefix}{key}" : null; default: - if ((value?.ToString() ?? null).IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(value?.ToString())) return p.IsDefined(typeof(OptionalAttribute)) ? null : throw new RequiredArgumentValueInvalidException(p.Name, this, null); if (p.IsDefined(typeof(QuoteAttribute))) diff --git a/Netch/Utils/Utils.cs b/Netch/Utils/Utils.cs index 2d4e0f97..4f817238 100644 --- a/Netch/Utils/Utils.cs +++ b/Netch/Utils/Utils.cs @@ -106,7 +106,7 @@ namespace Netch.Utils { var sha256 = SHA256.Create(); using var fileStream = File.OpenRead(filePath); - return sha256.ComputeHash(fileStream).Aggregate(string.Empty, (current, b) => current + b.ToString("x2")); + return string.Concat(sha256.ComputeHash(fileStream).Select(b => b.ToString("x2"))); } catch {