/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit/NullableAttributes.cs
78 строк
3 KB
Chris Patterson
Adding usage telemetry reporting, to track feature usage
13 мар 2025, 21:52
13 мар 2025, 21:52
e3b5b18
Код
Авторство
О чём код?
using System; #if !NET6_0_OR_GREATER && !NETSTANDARD2_1 namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter)] sealed class NotNullWhenAttribute : 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 will not be null. /// </param> public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } /// <summary>Gets the return value condition.</summary> public bool ReturnValue { get; } } } [AttributeUsage(AttributeTargets.Parameter)] 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 will not be null. /// </param> public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } /// <summary>Gets the return value condition.</summary> public bool ReturnValue { get; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] sealed class MemberNotNullWhenAttribute : Attribute { /// <summary>Initializes the attribute with the specified return value condition and a field or property member.</summary> /// <param name="returnValue"> /// The return value condition. If the method returns this value, the associated parameter will not be null. /// </param> /// <param name="member"> /// The field or property member that is promised to be not-null. /// </param> public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new[] { member }; } /// <summary>Initializes the attribute with the specified return value condition and list of field and property members.</summary> /// <param name="returnValue"> /// The return value condition. If the method returns this value, the associated parameter will not be null. /// </param> /// <param name="members"> /// The list of field and property members that are promised to be not-null. /// </param> public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } /// <summary>Gets the return value condition.</summary> public bool ReturnValue { get; } /// <summary>Gets field or property member names.</summary> public string[] Members { get; } } #endif