CodeGroup Class
Represents a node in a code group. A code group is a collection of security permissions for code that originates from a specific source.
Syntax
public abstract class CodeGroup : ISecurityEncodable, ISecurityIdentity, IPermission, SecurityElement.IElementCreator
Inheritance Hierarchy
- System.Object
- System.Net.Security.CAS.CodeGroup
Derived Classes
- System.Net.Security.CAS.FileCodeGroup
- System.Net.Security.CAS.RegistryCodeGroup
- System.Net.Security.CAS.StrongNameCodeGroup
- System.Net.Security.CAS.UrlCodeGroup
- System.Net.Security.CAS.ZoneCodeGroup
Remarks
Code groups are the building blocks of the .NET Framework code access security (CAS) policy. Each code group is associated with a security grant, which is a set of permissions applied to code that matches the criteria of the code group.
The CodeGroup class is an abstract base class that defines the common properties and methods for all code groups.
You typically do not instantiate CodeGroup directly, but rather use one of its derived classes to represent specific types
of code groups.
The .NET Framework uses a hierarchical structure of code groups to determine the security permissions granted to an assembly. When an assembly is loaded, the runtime traverses this hierarchy, evaluating each code group to see if the assembly's origin matches the group's membership condition. If it matches, the permissions associated with that code group are granted to the assembly.
Constructors
-
CodeGroup(IMembershipCondition membershipCondition, PermissionSet permSet)
Initializes a new instance of the
CodeGroupclass with the specified membership condition and permission set.
Properties
-
Attribute
Gets or sets the attribute of the code group.
-
Children
Gets a collection of child code groups.
-
Description
Gets or sets the description of the code group.
-
Name
Gets or sets the name of the code group.
-
Parent
Gets or sets the parent code group.
-
PermissionSet
Gets or sets the permission set associated with the code group.
Methods
-
CreateIdentityPermission(Evidence evidence)
Creates an identity permission for the specified evidence.
-
Equals(Object o)
Determines whether the specified object is equal to the current object.
-
FromXml(SecurityElement e)
Reconstructs a code group object from an XML element.
-
GetHashCode()
Serves as the default hash function.
-
GetType()
Gets the Type of the current instance.
-
Merge(CodeGroup group)
Merges the specified code group into the current code group.
-
ParseXml(SecurityElement e, Evidence evidence)
Parses an XML element into a new code group object.
-
ToString()
Returns a string that represents the current object.
-
ToXml()
Converts the code group object to an XML element.
Note
Code access security (CAS) is not supported in .NET Core 3.0 and later versions. For information on migrating CAS-based applications to .NET Core, see Migrating CAS-based applications to .NET Core.