< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 6
Coverable lines: 6
Total lines: 250
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
IsForwarder(...)100%110%
IsNested(...)100%110%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Reflection.Metadata/src/System/Reflection/System.Reflection.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4namespace System.Reflection
 5{
 6    [Flags]
 7    public enum MethodSemanticsAttributes
 8    {
 9        /// <summary>
 10        /// Used to modify the value of the property.
 11        /// CLS-compliant setters are named with set_ prefix.
 12        /// </summary>
 13        Setter = 0x0001,
 14
 15        /// <summary>
 16        /// Used to read the value of the property.
 17        /// CLS-compliant getters are named with get_ prefix.
 18        /// </summary>
 19        Getter = 0x0002,
 20
 21        /// <summary>
 22        /// Other method for property (not getter or setter) or event (not adder, remover, or raiser).
 23        /// </summary>
 24        Other = 0x0004,
 25
 26        /// <summary>
 27        /// Used to add a handler for an event.
 28        /// Corresponds to the AddOn flag in the Ecma 335 CLI specification.
 29        /// CLS-compliant adders are named with add_ prefix.
 30        /// </summary>
 31        Adder = 0x0008,
 32
 33        /// <summary>
 34        /// Used to remove a handler for an event.
 35        /// Corresponds to the RemoveOn flag in the Ecma 335 CLI specification.
 36        /// CLS-compliant removers are named with remove_ prefix.
 37        /// </summary>
 38        Remover = 0x0010,
 39
 40        /// <summary>
 41        /// Used to indicate that an event has occurred.
 42        /// Corresponds to the Fire flag in the Ecma 335 CLI specification.
 43        /// CLS-compliant raisers are named with raise_ prefix.
 44        /// </summary>
 45        Raiser = 0x0020,
 46    }
 47
 48    /// <summary>
 49    /// Specifies the security actions that can be performed using declarative security.
 50    /// </summary>
 51    public enum DeclarativeSecurityAction : short
 52    {
 53        /// <summary>
 54        /// No declarative security action.
 55        /// </summary>
 56        None = 0x0000,
 57
 58        /// <summary>
 59        /// Check that all callers in the call chain have been granted specified permission,
 60        /// </summary>
 61        Demand = 0x0002,
 62
 63        /// <summary>
 64        /// The calling code can access the resource identified by the current permission object, even if callers higher
 65        /// </summary>
 66        Assert = 0x0003,
 67
 68        /// <summary>
 69        /// Without further checks refuse Demand for the specified permission.
 70        /// </summary>
 71        Deny = 0x0004,
 72
 73        /// <summary>
 74        /// Without further checks, refuse Demand for all permissions other than those specified.
 75        /// </summary>
 76        PermitOnly = 0x0005,
 77
 78        /// <summary>
 79        /// Check that the immediate caller has been granted the specified permission;
 80        /// </summary>
 81        LinkDemand = 0x0006,
 82
 83        /// <summary>
 84        /// The derived class inheriting the class or overriding a method is required to have been granted the specified
 85        /// </summary>
 86        InheritanceDemand = 0x0007,
 87
 88        /// <summary>
 89        /// The request for the minimum permissions required for code to run. This action can only be used within the sc
 90        /// </summary>
 91        RequestMinimum = 0x0008,
 92
 93        /// <summary>
 94        /// The request for additional permissions that are optional (not required to run). This request implicitly refu
 95        /// </summary>
 96        RequestOptional = 0x0009,
 97
 98        /// <summary>
 99        /// The request that permissions that might be misused will not be granted to the calling code. This action can 
 100        /// </summary>
 101        RequestRefuse = 0x000A,
 102        // Wait for an actual need before exposing these. They all have ilasm keywords, but some are missing from the CL
 103        // and none are defined in System.Security.Permissions.SecurityAction.
 104        //Request = 0x0001,
 105        //PrejitGrant = 0x000B,
 106        //PrejitDeny = 0x000C,
 107        //NonCasDemand = 0x000D,
 108        //NonCasLinkDemand = 0x000E,
 109        //NonCasInheritanceDemand = 0x000F,
 110    }
 111
 112    [Flags]
 113    public enum MethodImportAttributes : short
 114    {
 115        None = 0x0,
 116        ExactSpelling = 0x0001,
 117        BestFitMappingDisable = 0x0020,
 118        BestFitMappingEnable = 0x0010,
 119        BestFitMappingMask = 0x0030,
 120        CharSetAnsi = 0x0002,
 121        CharSetUnicode = 0x0004,
 122        CharSetAuto = 0x0006,
 123        CharSetMask = 0x0006,
 124        ThrowOnUnmappableCharEnable = 0x1000,
 125        ThrowOnUnmappableCharDisable = 0x2000,
 126        ThrowOnUnmappableCharMask = 0x3000,
 127        SetLastError = 0x0040,
 128        CallingConventionWinApi = 0x0100,
 129        CallingConventionCDecl = 0x0200,
 130        CallingConventionStdCall = 0x0300,
 131        CallingConventionThisCall = 0x0400,
 132        CallingConventionFastCall = 0x0500,
 133        CallingConventionMask = 0x0700,
 134    }
 135
 136    [Flags]
 137    public enum ManifestResourceAttributes
 138    {
 139        /// <summary>
 140        /// The Resource is exported from the Assembly
 141        /// </summary>
 142        Public = 0x00000001,
 143
 144        /// <summary>
 145        /// The Resource is not exported from the Assembly
 146        /// </summary>
 147        Private = 0x00000002,
 148
 149        /// <summary>
 150        /// Masks just the visibility-related attributes.
 151        /// </summary>
 152        VisibilityMask = 0x00000007, // Although it is odd that there is a 3rd bit with no corresponding flag, it is def
 153    }
 154
 155    /// <summary>
 156    /// Specifies all the hash algorithms used for hashing assembly files and for generating the strong name.
 157    /// </summary>
 158    public enum AssemblyHashAlgorithm
 159    {
 160        /// <summary>
 161        /// A mask indicating that there is no hash algorithm. If you specify None for a multi-module assembly, the comm
 162        /// </summary>
 163        None = 0,
 164
 165        /// <summary>
 166        /// Retrieves the MD5 message-digest algorithm. MD5 was developed by Rivest in 1991. It is basically MD4 with sa
 167        /// </summary>
 168        MD5 = 0x8003,
 169
 170        /// <summary>
 171        /// Retrieves a revision of the Secure Hash Algorithm that corrects an unpublished flaw in SHA.
 172        /// </summary>
 173        Sha1 = 0x8004,
 174
 175        /// <summary>
 176        /// Retrieves a version of the Secure Hash Algorithm with a hash size of 256 bits.
 177        /// </summary>
 178        Sha256 = 0x800c,
 179
 180        /// <summary>
 181        /// Retrieves a version of the Secure Hash Algorithm with a hash size of 384 bits.
 182        /// </summary>
 183        Sha384 = 0x800d,
 184
 185        /// <summary>
 186        /// Retrieves a version of the Secure Hash Algorithm with a hash size of 512 bits.
 187        /// </summary>
 188        Sha512 = 0x800e
 189    }
 190
 191    [Flags]
 192    public enum AssemblyFlags
 193    {
 194        /// <summary>
 195        /// The assembly reference holds the full (unhashed) public key.
 196        /// Not applicable on assembly definition.
 197        /// </summary>
 198        PublicKey = 0x00000001,
 199
 200        /// <summary>
 201        /// The implementation of the referenced assembly used at runtime is not expected to match the version seen at c
 202        /// </summary>
 203        Retargetable = 0x00000100,
 204
 205        /// <summary>
 206        /// The assembly contains Windows Runtime code.
 207        /// </summary>
 208        WindowsRuntime = 0x00000200,
 209
 210        /// <summary>
 211        /// Content type mask. Masked bits correspond to values of <see cref="System.Reflection.AssemblyContentType"/>.
 212        /// </summary>
 213        ContentTypeMask = 0x00000e00,
 214
 215        /// <summary>
 216        /// Specifies that just-in-time (JIT) compiler optimization is disabled for the assembly.
 217        /// </summary>
 218        DisableJitCompileOptimizer = 0x4000,
 219
 220        /// <summary>
 221        /// Specifies that just-in-time (JIT) compiler tracking is enabled for the assembly.
 222        /// </summary>
 223        EnableJitCompileTracking = 0x8000,
 224    }
 225
 226    internal static class TypeAttributesExtensions
 227    {
 228        // This flag will be added to the BCL (Bug VS#1041207), but we still
 229        // need to define a copy here for downlevel portability.
 230        private const TypeAttributes Forwarder = (TypeAttributes)0x00200000;
 231
 232        // This mask is the fastest way to check if a type is nested from its flags,
 233        // but it should not be added to the BCL enum as its semantics can be misleading.
 234        // Consider, for example, that (NestedFamANDAssem & NestedMask) == NestedFamORAssem.
 235        // Only comparison of the masked value to 0 is meaningful, which is different from
 236        // the other masks in the enum.
 237        private const TypeAttributes NestedMask = (TypeAttributes)0x00000006;
 238
 239        public static bool IsForwarder(this TypeAttributes flags)
 0240        {
 0241            return (flags & Forwarder) != 0;
 0242        }
 243
 244        public static bool IsNested(this TypeAttributes flags)
 0245        {
 0246            return (flags & NestedMask) != 0;
 0247        }
 248    }
 249}
 250