// #pragma warning disable #nullable enable annotations // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Diagnostics.CodeAnalysis { /// /// States a dependency that one member has on another. /// /// /// This can be used to inform tooling of a dependency that is otherwise not evident purely from /// metadata and IL, for example a member relied on via reflection. /// [global::System.AttributeUsage( global::System.AttributeTargets.Constructor | global::System.AttributeTargets.Field | global::System.AttributeTargets.Method, AllowMultiple = true, Inherited = false)] [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [global::System.Diagnostics.Conditional("MULTI_TARGETING_SUPPORT_ATTRIBUTES")] public sealed class DynamicDependencyAttribute : global::System.Attribute { /// /// Initializes a new instance of the class /// with the specified signature of a member on the same type as the consumer. /// /// The signature of the member depended on. public DynamicDependencyAttribute(string memberSignature) { MemberSignature = memberSignature; } /// /// Initializes a new instance of the class /// with the specified signature of a member on a . /// /// The signature of the member depended on. /// The containing . public DynamicDependencyAttribute(string memberSignature, global::System.Type type) { MemberSignature = memberSignature; Type = type; } /// /// Initializes a new instance of the class /// with the specified signature of a member on a type in an assembly. /// /// The signature of the member depended on. /// The full name of the type containing the specified member. /// The assembly name of the type containing the specified member. public DynamicDependencyAttribute(string memberSignature, string typeName, string assemblyName) { MemberSignature = memberSignature; TypeName = typeName; AssemblyName = assemblyName; } /// /// Initializes a new instance of the class /// with the specified types of members on a . /// /// The types of members depended on. /// The containing the specified members. public DynamicDependencyAttribute(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes memberTypes, global::System.Type type) { MemberTypes = memberTypes; Type = type; } /// /// Initializes a new instance of the class /// with the specified types of members on a type in an assembly. /// /// The types of members depended on. /// The full name of the type containing the specified members. /// The assembly name of the type containing the specified members. public DynamicDependencyAttribute(global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes memberTypes, string typeName, string assemblyName) { MemberTypes = memberTypes; TypeName = typeName; AssemblyName = assemblyName; } /// /// Gets the signature of the member depended on. /// /// /// Either must be a valid string or /// must not equal , but not both. /// public string? MemberSignature { get; } /// /// Gets the which specifies the type /// of members depended on. /// /// /// Either must be a valid string or /// must not equal , but not both. /// public global::System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberTypes { get; } /// /// Gets the containing the specified member. /// /// /// If neither nor are specified, /// the type of the consumer is assumed. /// public global::System.Type? Type { get; } /// /// Gets the full name of the type containing the specified member. /// /// /// If neither nor are specified, /// the type of the consumer is assumed. /// public string? TypeName { get; } /// /// Gets the assembly name of the specified type. /// /// /// is only valid when is specified. /// public string? AssemblyName { get; } /// /// Gets or sets the condition in which the dependency is applicable, e.g. "DEBUG". /// public string? Condition { get; set; } } }