1
0
mirror of https://github.com/chylex/.NET-Community-Toolkit.git synced 2024-11-25 01:42:46 +01:00
.NET-Community-Toolkit/CommunityToolkit.Diagnostics/Attributes/DoesNotReturnIfAttribute.cs
2021-11-01 20:46:46 +01:00

35 lines
1.2 KiB
C#

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#if !NETSTANDARD2_1_OR_GREATER
namespace System.Diagnostics.CodeAnalysis;
/// <summary>
/// Specifies that a given <see cref="ParameterValue"/> also indicates
/// whether the method will not return (eg. throw an exception).
/// </summary>
/// <remarks>Internal copy from the BCL attribute.</remarks>
[AttributeUsage(AttributeTargets.Parameter)]
internal sealed class DoesNotReturnIfAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="DoesNotReturnIfAttribute"/> class.
/// </summary>
/// <param name="parameterValue">
/// The condition parameter value. Code after the method will be considered unreachable
/// by diagnostics if the argument to the associated parameter matches this value.
/// </param>
public DoesNotReturnIfAttribute(bool parameterValue)
{
ParameterValue = parameterValue;
}
/// <summary>
/// Gets a value indicating whether the parameter value should be <see langword="true"/>.
/// </summary>
public bool ParameterValue { get; }
}
#endif