NamedPermissionSet NamedPermissionSet NamedPermissionSet NamedPermissionSet Class

Definition

Defines a permission set that has a name and description associated with it. This class cannot be inherited.

public ref class NamedPermissionSet sealed : System::Security::PermissionSet
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class NamedPermissionSet : System.Security.PermissionSet
type NamedPermissionSet = class
    inherit PermissionSet
Public NotInheritable Class NamedPermissionSet
Inherits PermissionSet
Inheritance
NamedPermissionSetNamedPermissionSetNamedPermissionSetNamedPermissionSet
Attributes

Examples

The following code example shows the use of members of the NamedPermissionSet class.

Remarks

Named permission sets are used in security policy administration to specify the permissions to be granted to code that belongs to certain code groups. Names are strings of alphanumeric characters. Description strings can consist of any printable characters.

Constructors

NamedPermissionSet(NamedPermissionSet) NamedPermissionSet(NamedPermissionSet) NamedPermissionSet(NamedPermissionSet) NamedPermissionSet(NamedPermissionSet)

Initializes a new instance of the NamedPermissionSet class from another named permission set.

NamedPermissionSet(String) NamedPermissionSet(String) NamedPermissionSet(String) NamedPermissionSet(String)

Initializes a new, empty instance of the NamedPermissionSet class with the specified name.

NamedPermissionSet(String, PermissionSet) NamedPermissionSet(String, PermissionSet) NamedPermissionSet(String, PermissionSet) NamedPermissionSet(String, PermissionSet)

Initializes a new instance of the NamedPermissionSet class with the specified name from a permission set.

NamedPermissionSet(String, PermissionState) NamedPermissionSet(String, PermissionState) NamedPermissionSet(String, PermissionState) NamedPermissionSet(String, PermissionState)

Initializes a new instance of the NamedPermissionSet class with the specified name in either an unrestricted or a fully restricted state.

Properties

Count Count Count Count

Gets the number of permission objects contained in the permission set.

(Inherited from PermissionSet)
Description Description Description Description

Gets or sets the text description of the current named permission set.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

Gets a value indicating whether the collection is read-only.

(Inherited from PermissionSet)
IsSynchronized IsSynchronized IsSynchronized IsSynchronized

Gets a value indicating whether the collection is guaranteed to be thread safe.

(Inherited from PermissionSet)
Name Name Name Name

Gets or sets the name of the current named permission set.

SyncRoot SyncRoot SyncRoot SyncRoot

Gets the root object of the current collection.

(Inherited from PermissionSet)

Methods

AddPermission(IPermission) AddPermission(IPermission) AddPermission(IPermission) AddPermission(IPermission)

Adds a specified permission to the PermissionSet.

(Inherited from PermissionSet)
AddPermissionImpl(IPermission) AddPermissionImpl(IPermission) AddPermissionImpl(IPermission) AddPermissionImpl(IPermission)

Adds a specified permission to the PermissionSet.

(Inherited from PermissionSet)
Assert() Assert() Assert() Assert()

Declares that the calling code can access the resource protected by a permission demand through the code that calls this method, even if callers higher in the stack have not been granted permission to access the resource. Using Assert() can create security vulnerabilities.

(Inherited from PermissionSet)
ContainsNonCodeAccessPermissions() ContainsNonCodeAccessPermissions() ContainsNonCodeAccessPermissions() ContainsNonCodeAccessPermissions()

Gets a value indicating whether the PermissionSet contains permissions that are not derived from CodeAccessPermission.

(Inherited from PermissionSet)
Copy() Copy() Copy() Copy()

Creates a permission set copy from a named permission set.

Copy(String) Copy(String) Copy(String) Copy(String)

Creates a copy of the named permission set with a different name but the same permissions.

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

Copies the permission objects of the set to the indicated location in an Array.

(Inherited from PermissionSet)
Demand() Demand() Demand() Demand()

Forces a SecurityException at run time if all callers higher in the call stack have not been granted the permissions specified by the current instance.

(Inherited from PermissionSet)
Deny() Deny() Deny() Deny()

Causes any Demand() that passes through the calling code for a permission that has an intersection with a permission of a type contained in the current PermissionSet to fail.

(Inherited from PermissionSet)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified NamedPermissionSet object is equal to the current NamedPermissionSet.

FromXml(SecurityElement) FromXml(SecurityElement) FromXml(SecurityElement) FromXml(SecurityElement)

Reconstructs a named permission set with a specified state from an XML encoding.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator for the permissions of the set.

(Inherited from PermissionSet)
GetEnumeratorImpl() GetEnumeratorImpl() GetEnumeratorImpl() GetEnumeratorImpl()

Returns an enumerator for the permissions of the set.

(Inherited from PermissionSet)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Gets a hash code for the NamedPermissionSet object that is suitable for use in hashing algorithms and data structures such as a hash table.

GetPermission(Type) GetPermission(Type) GetPermission(Type) GetPermission(Type)

Gets a permission object of the specified type, if it exists in the set.

(Inherited from PermissionSet)
GetPermissionImpl(Type) GetPermissionImpl(Type) GetPermissionImpl(Type) GetPermissionImpl(Type)

Gets a permission object of the specified type, if it exists in the set.

(Inherited from PermissionSet)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
Intersect(PermissionSet) Intersect(PermissionSet) Intersect(PermissionSet) Intersect(PermissionSet)

Creates and returns a permission set that is the intersection of the current PermissionSet and the specified PermissionSet.

(Inherited from PermissionSet)
IsEmpty() IsEmpty() IsEmpty() IsEmpty()

Gets a value indicating whether the PermissionSet is empty.

(Inherited from PermissionSet)
IsSubsetOf(PermissionSet) IsSubsetOf(PermissionSet) IsSubsetOf(PermissionSet) IsSubsetOf(PermissionSet)

Determines whether the current PermissionSet is a subset of the specified PermissionSet.

(Inherited from PermissionSet)
IsUnrestricted() IsUnrestricted() IsUnrestricted() IsUnrestricted()

Determines whether the PermissionSet is Unrestricted.

(Inherited from PermissionSet)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
PermitOnly() PermitOnly() PermitOnly() PermitOnly()

Causes any Demand() that passes through the calling code for any PermissionSet that is not a subset of the current PermissionSet to fail.

(Inherited from PermissionSet)
RemovePermission(Type) RemovePermission(Type) RemovePermission(Type) RemovePermission(Type)

Removes a permission of a certain type from the set.

(Inherited from PermissionSet)
RemovePermissionImpl(Type) RemovePermissionImpl(Type) RemovePermissionImpl(Type) RemovePermissionImpl(Type)

Removes a permission of a certain type from the set.

(Inherited from PermissionSet)
SetPermission(IPermission) SetPermission(IPermission) SetPermission(IPermission) SetPermission(IPermission)

Sets a permission to the PermissionSet, replacing any existing permission of the same type.

(Inherited from PermissionSet)
SetPermissionImpl(IPermission) SetPermissionImpl(IPermission) SetPermissionImpl(IPermission) SetPermissionImpl(IPermission)

Sets a permission to the PermissionSet, replacing any existing permission of the same type.

(Inherited from PermissionSet)
ToString() ToString() ToString() ToString()

Returns a string representation of the PermissionSet.

(Inherited from PermissionSet)
ToXml() ToXml() ToXml() ToXml()

Creates an XML element description of the named permission set.

Union(PermissionSet) Union(PermissionSet) Union(PermissionSet) Union(PermissionSet)

Creates a PermissionSet that is the union of the current PermissionSet and the specified PermissionSet.

(Inherited from PermissionSet)

Explicit Interface Implementations

IDeserializationCallback.OnDeserialization(Object) IDeserializationCallback.OnDeserialization(Object) IDeserializationCallback.OnDeserialization(Object) IDeserializationCallback.OnDeserialization(Object)

Runs when the entire object graph has been deserialized.

(Inherited from PermissionSet)

Extension Methods

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to