| File: parent\parent\Shared\FxPolyfills\ArgumentException.cs | |
| Project: ..\..\..\src\Libraries\Microsoft.Extensions.ServiceDiscovery\Microsoft.Extensions.ServiceDiscovery.csproj (Microsoft.Extensions.ServiceDiscovery) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; namespace System; internal static partial class FxPolyfillArgumentException { extension(ArgumentException) { public static void ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null) { if (string.IsNullOrEmpty(argument)) { ThrowNullOrEmptyException(argument, paramName); } } } [DoesNotReturn] private static void ThrowNullOrEmptyException(string? argument, string? paramName) { ArgumentNullException.ThrowIfNull(argument, paramName); throw new ArgumentException("The value cannot be an empty string.", paramName); } }