/
dev-npgsql
/
npgsql
Обзор
Документация
Войти
/
dev-npgsql
/
npgsql
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
v9.0.1
src/Shared/CodeAnalysis.cs
82 строки
3 KB
Shay Rojansky
Expression-bodied methods
30 окт 2024, 18:41
30 окт 2024, 18:41
a770d79
Код
Авторство
О чём код?
namespace System.Diagnostics.CodeAnalysis { #if !NET7_0_OR_GREATER /// <summary> /// Indicates that the specified method requires the ability to generate new code at runtime, /// for example through <see cref="System.Reflection"/>. /// </summary> /// <remarks> /// This allows tools to understand which methods are unsafe to call when compiling ahead of time. /// </remarks> [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)] sealed class RequiresDynamicCodeAttribute : Attribute { /// <summary> /// Initializes a new instance of the <see cref="RequiresDynamicCodeAttribute"/> class /// with the specified message. /// </summary> /// <param name="message"> /// A message that contains information about the usage of dynamic code. /// </param> public RequiresDynamicCodeAttribute(string message) => Message = message; /// <summary> /// Gets a message that contains information about the usage of dynamic code. /// </summary> public string Message { get; } /// <summary> /// Gets or sets an optional URL that contains more information about the method, /// why it requires dynamic code, and what options a consumer has to deal with it. /// </summary> public string? Url { get; set; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsageAttribute(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] sealed class UnscopedRefAttribute : Attribute { /// <summary> /// Initializes a new instance of the <see cref="UnscopedRefAttribute"/> class. /// </summary> public UnscopedRefAttribute() { } } #endif } namespace System.Runtime.CompilerServices { #if !NET7_0_OR_GREATER [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] sealed class CompilerFeatureRequiredAttribute(string featureName) : Attribute { /// <summary> /// The name of the compiler feature. /// </summary> public string FeatureName { get; } = featureName; /// <summary> /// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand <see cref="FeatureName"/>. /// </summary> public bool IsOptional { get; set; } /// <summary> /// The <see cref="FeatureName"/> used for the ref structs C# feature. /// </summary> public const string RefStructs = nameof(RefStructs); /// <summary> /// The <see cref="FeatureName"/> used for the required members C# feature. /// </summary> public const string RequiredMembers = nameof(RequiredMembers); } #endif }