<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.5" />

ThrowHelper

static class ThrowHelper
using System.Runtime.CompilerServices; namespace System { internal static class ThrowHelper { internal static void ThrowIfNull(object argument, [System.Runtime.CompilerServices.CallerArgumentExpression("argument")] string paramName = null) { if (argument == null) Throw(paramName); } private static void Throw(string paramName) { throw new ArgumentNullException(paramName); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string IfNullOrWhitespace(string argument, [System.Runtime.CompilerServices.CallerArgumentExpression("argument")] string paramName = "") { if (argument == null) throw new ArgumentNullException(paramName); if (string.IsNullOrWhiteSpace(argument)) { if (argument == null) throw new ArgumentNullException(paramName); throw new ArgumentException(paramName, "Argument is whitespace"); } return argument; } } }