<PackageReference Include="System.Threading.AccessControl" Version="10.0.6" />

System.Security.AccessControl.SemaphoreSecurity

public sealed class SemaphoreSecurity : NativeObjectSecurity
Represents the Windows access control security for a named semaphore. This class cannot be inherited.

Initializes a new instance of the SemaphoreSecurity class with default values.

public SemaphoreSecurity(string name, AccessControlSections includeSections)

Initializes a new instance of the SemaphoreSecurity class with the specified sections of the access control security rules from the system semaphore with the specified name.

Searches for a matching rule with which the new rule can be merged. If none are found, adds the new rule.

public void AddAuditRule(SemaphoreAuditRule rule)

Searches for an audit rule with which the new rule can be merged. If none are found, adds the new rule.

Searches for an access control rule with the same user and AccessControlType (allow or deny) as the specified rule, and with compatible inheritance and propagation flags; if such a rule is found, the rights contained in the specified access rule are removed from it.

Searches for all access control rules with the same user and AccessControlType (allow or deny) as the specified rule and, if found, removes them.

Searches for an access control rule that exactly matches the specified rule and, if found, removes it.

Searches for an audit control rule with the same user as the specified rule, and with compatible inheritance and propagation flags; if a compatible rule is found, the rights contained in the specified rule are removed from it.

Searches for all audit rules with the same user as the specified rule and, if found, removes them.

Searches for an audit rule that exactly matches the specified rule and, if found, removes it.

Removes all access control rules with the same user as the specified rule, regardless of AccessControlType, and then adds the specified rule.

Removes all access control rules with the same user and AccessControlType (allow or deny) as the specified rule, and then adds the specified rule.

public void SetAuditRule(SemaphoreAuditRule rule)

Removes all audit rules with the same user as the specified rule, regardless of the AuditFlags value, and then adds the specified rule.