Namespace: System.Net.Security

RegistryCodeGroupEntry Class

Represents a code group that is identified by a registry value. This class cannot be inherited.

Note: This class is part of the .NET Framework.

Declaration

public sealed class RegistryCodeGroupEntry : CodeGroup

Inheritance Hierarchy

System.Object
System.Security.Policy.CodeGroup
System.Security.Policy.RegistryCodeGroupEntry

Table of Contents

Constructors

RegistryCodeGroupEntry (constructor)

Initializes a new instance of the RegistryCodeGroupEntry class.

public RegistryCodeGroupEntry();

Initializes a new instance of the RegistryCodeGroupEntry class with the specified name and description.

public RegistryCodeGroupEntry(string name, string description);

Properties

Name Description
AttributeDecimal Gets or sets the integer value of the attribute.
AttributeString Gets or sets the string representation of the attribute.
IdentityReference Gets the identity reference associated with the code group.
RegistryKeyAccess Gets or sets the registry key access flags.

Methods

Name Description
Copy Creates a new code group that is a copy of the current code group.
CreateXsdEntry Creates an XML Schema definition language (XSD) representation of the code group.
Equals Determines whether the specified object is equal to the current object.
GetHashCode Serves as the default hash function.
GetType Gets the type of the current instance.
Merge Merges the specified code group into the current code group.
ParseXml Parses the specified XML fragment to configure the policy level.
ToString Returns a string that represents the current object.

Remarks

The RegistryCodeGroupEntry class is used to define a security policy that is based on the presence of a specific registry key. When code is executed, the .NET security system checks for the existence of the specified registry key. If the key is found, the permissions associated with this code group are granted to the code.

This class is useful for scenarios where you need to grant specific permissions to applications that are installed in certain locations or that have specific registry settings.

Key properties to consider when using RegistryCodeGroupEntry:

  • IdentityReference: Specifies the identity of the code group.
  • AttributeDecimal or AttributeString: Defines the registry value to check.
  • RegistryKeyAccess: Specifies the type of access required to the registry key.

Requirements

Assembly File name
System.dll System.dll

.NET Framework Versions

Supported in the following versions: 4.5, 4.5.1, 4.5.2, 4.5.3, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, .NET Core 2.0, .NET Core 2.1, .NET Core 2.2, .NET Core 3.0, .NET Core 3.1, .NET 5, .NET 6, .NET 7, .NET 8.

.NET Standard Versions

Not supported.