1
0
mirror of https://github.com/chylex/.NET-Community-Toolkit.git synced 2024-10-17 15:42:47 +02:00
.NET-Community-Toolkit/CommunityToolkit.Mvvm/Properties/Polyfills/Attributes/MaybeNullWhenAttribute.cs
2021-12-14 10:33:05 +01:00

31 lines
1.1 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_0
namespace System.Diagnostics.CodeAnalysis;
/// <summary>
/// Specifies that when a method returns <see cref="ReturnValue"/>, the parameter may be null even if the corresponding type disallows it.
/// </summary>
/// <remarks>Internal copy from the BCL attribute.</remarks>
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
internal sealed class MaybeNullWhenAttribute : Attribute
{
/// <summary>
/// Initializes the attribute with the specified return value condition.
/// </summary>
/// <param name="returnValue">The return value condition. If the method returns this value, the associated parameter may be null.</param>
public MaybeNullWhenAttribute(bool returnValue)
{
ReturnValue = returnValue;
}
/// <summary>
/// Gets the return value condition.
/// </summary>
public bool ReturnValue { get; }
}
#endif