/
EventWaitHandleAccessRule.xml
288 lines (248 loc) · 24.4 KB
/
EventWaitHandleAccessRule.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<Type Name="EventWaitHandleAccessRule" FullName="System.Security.AccessControl.EventWaitHandleAccessRule">
<TypeSignature Language="C#" Value="public sealed class EventWaitHandleAccessRule : System.Security.AccessControl.AccessRule" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit EventWaitHandleAccessRule extends System.Security.AccessControl.AccessRule" />
<TypeSignature Language="DocId" Value="T:System.Security.AccessControl.EventWaitHandleAccessRule" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class EventWaitHandleAccessRule
Inherits AccessRule" />
<TypeSignature Language="F#" Value="type EventWaitHandleAccessRule = class
 inherit AccessRule" />
<TypeSignature Language="C++ CLI" Value="public ref class EventWaitHandleAccessRule sealed : System::Security::AccessControl::AccessRule" />
<AssemblyInfo>
<AssemblyName>System.Threading.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<TypeForwardingChain>
<TypeForwarding From="System.Threading.AccessControl" FromVersion="9.0.0.0" To="mscorlib" ToVersion="4.0.0.0" FrameworkAlternate="netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1" />
</TypeForwardingChain>
<Base>
<BaseTypeName>System.Security.AccessControl.AccessRule</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="net-8.0;net-9.0;windowsdesktop-8.0;windowsdesktop-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(0)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(0)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="net-8.0;net-9.0;windowsdesktop-8.0;windowsdesktop-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.NullableContext(1)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.NullableContext(1)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netcore-1.0;netcore-1.1">
<AttributeName Language="C#">[System.Security.SecurityCritical]</AttributeName>
<AttributeName Language="F#">[<System.Security.SecurityCritical>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents a set of access rights allowed or denied for a user or group. This class cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Security.AccessControl.EventWaitHandleAccessRule> class is one of a set of classes that the .NET Framework provides for managing Windows access control security on named system events. For an overview of these classes, and their relationship to the underlying Windows access control structures, see <xref:System.Security.AccessControl.EventWaitHandleSecurity>.
> [!NOTE]
> Windows access control security is meaningful only for named system events. If an <xref:System.Threading.EventWaitHandle> object represents a local event, access control is irrelevant.
To get a list of the rules currently applied to a named event, use the <xref:System.Threading.EventWaitHandle.GetAccessControl%2A?displayProperty=nameWithType> method to get an <xref:System.Security.AccessControl.EventWaitHandleSecurity> object, and then use its <xref:System.Security.AccessControl.CommonObjectSecurity.GetAccessRules%2A> method to obtain a collection of <xref:System.Security.AccessControl.EventWaitHandleAccessRule> objects.
<xref:System.Security.AccessControl.EventWaitHandleAccessRule> objects do not map one-to-one with access control entries in the underlying discretionary access control list (DACL). When you get the set of all access rules for an event, the set contains the minimum number of rules currently required to express all the access control entries.
> [!NOTE]
> The underlying access control entries change as you apply and remove rules. The information in rules is merged if possible, to maintain the smallest number of access control entries. Thus, when you get the current list of rules, it might not look exactly like the list of all the rules you have added.
Use <xref:System.Security.AccessControl.EventWaitHandleAccessRule> objects to specify the access rights to allow or deny to a user or group. An <xref:System.Security.AccessControl.EventWaitHandleAccessRule> object always represents either allowed access or denied access, never both.
To apply a rule to a named system event, use the <xref:System.Threading.EventWaitHandle.GetAccessControl%2A?displayProperty=nameWithType> method to get the <xref:System.Security.AccessControl.EventWaitHandleSecurity> object. Modify the <xref:System.Security.AccessControl.EventWaitHandleSecurity> object by using its methods to add the rule, and then use the <xref:System.Threading.EventWaitHandle.SetAccessControl%2A?displayProperty=nameWithType> method to reattach the security object.
> [!IMPORTANT]
> Changes you make to an <xref:System.Security.AccessControl.EventWaitHandleSecurity> object do not affect the access levels of the named event until you call the <xref:System.Threading.EventWaitHandle.SetAccessControl%2A?displayProperty=nameWithType> method to assign the altered security object to the named event.
<xref:System.Security.AccessControl.EventWaitHandleAccessRule> objects are immutable. Security for an event is modified using the methods of the <xref:System.Security.AccessControl.EventWaitHandleSecurity> class to add or remove rules; as you do this, the underlying access control entries are modified.
## Examples
The following code example demonstrates the creation and use of <xref:System.Security.AccessControl.EventWaitHandleAccessRule> objects. The example creates an <xref:System.Security.AccessControl.EventWaitHandleSecurity> object, adds rules that allow and deny various rights for the current user, and displays the resulting pair of rules. The example then allows new rights for the current user and displays the result, showing that the new rights are merged with the existing <xref:System.Security.AccessControl.AccessControlType.Allow> rule.
> [!NOTE]
> This example does not attach the security object to a <xref:System.Threading.EventWaitHandle> object. Examples that attach security objects can be found in <xref:System.Threading.EventWaitHandle.GetAccessControl%2A?displayProperty=nameWithType> and <xref:System.Threading.EventWaitHandle.SetAccessControl%2A?displayProperty=nameWithType>.
:::code language="csharp" source="~/snippets/csharp/System.Security.AccessControl/EventWaitHandleAccessRule/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.AccessControl.EventWaitHandleSecurity.AddAccessRule/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.Security.AccessControl.EventWaitHandleSecurity" />
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Threading.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Security.AccessControl.EventWaitHandleAccessRule" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public EventWaitHandleAccessRule (System.Security.Principal.IdentityReference identity, System.Security.AccessControl.EventWaitHandleRights eventRights, System.Security.AccessControl.AccessControlType type);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Security.Principal.IdentityReference identity, valuetype System.Security.AccessControl.EventWaitHandleRights eventRights, valuetype System.Security.AccessControl.AccessControlType type) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.EventWaitHandleAccessRule.#ctor(System.Security.Principal.IdentityReference,System.Security.AccessControl.EventWaitHandleRights,System.Security.AccessControl.AccessControlType)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (identity As IdentityReference, eventRights As EventWaitHandleRights, type As AccessControlType)" />
<MemberSignature Language="F#" Value="new System.Security.AccessControl.EventWaitHandleAccessRule : System.Security.Principal.IdentityReference * System.Security.AccessControl.EventWaitHandleRights * System.Security.AccessControl.AccessControlType -> System.Security.AccessControl.EventWaitHandleAccessRule" Usage="new System.Security.AccessControl.EventWaitHandleAccessRule (identity, eventRights, type)" />
<MemberSignature Language="C++ CLI" Value="public:
 EventWaitHandleAccessRule(System::Security::Principal::IdentityReference ^ identity, System::Security::AccessControl::EventWaitHandleRights eventRights, System::Security::AccessControl::AccessControlType type);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Threading.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="identity" Type="System.Security.Principal.IdentityReference" />
<Parameter Name="eventRights" Type="System.Security.AccessControl.EventWaitHandleRights" />
<Parameter Name="type" Type="System.Security.AccessControl.AccessControlType" />
</Parameters>
<Docs>
<param name="identity">The user or group the rule applies to. Must be of type <see cref="T:System.Security.Principal.SecurityIdentifier" /> or a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</param>
<param name="eventRights">A bitwise combination of <see cref="T:System.Security.AccessControl.EventWaitHandleRights" /> values specifying the rights allowed or denied.</param>
<param name="type">One of the <see cref="T:System.Security.AccessControl.AccessControlType" /> values specifying whether the rights are allowed or denied.</param>
<summary>Initializes a new instance of the <see cref="T:System.Security.AccessControl.EventWaitHandleAccessRule" /> class, specifying the user or group the rule applies to, the access rights, and whether the specified access rights are allowed or denied.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
To wait on an <xref:System.Threading.EventWaitHandle> (by calling the <xref:System.Threading.WaitHandle.WaitOne%2A>, <xref:System.Threading.WaitHandle.WaitAny%2A> or <xref:System.Threading.WaitHandle.WaitAll%2A> method), a user must have <xref:System.Security.AccessControl.EventWaitHandleRights.Synchronize?displayProperty=nameWithType> access. To signal an event by calling the <xref:System.Threading.EventWaitHandle.Set%2A> method, or to reset it to the unsignaled state by calling the <xref:System.Threading.EventWaitHandle.Reset%2A> method, a user must have <xref:System.Security.AccessControl.EventWaitHandleRights.Modify?displayProperty=nameWithType> access. To signal an <xref:System.Threading.EventWaitHandle> object and then wait on it by calling the <xref:System.Threading.WaitHandle.SignalAndWait%2A> method, a user must have <xref:System.Security.AccessControl.EventWaitHandleRights.Synchronize> and <xref:System.Security.AccessControl.EventWaitHandleRights.Modify> access.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="eventRights" /> specifies an invalid value.
-or-
<paramref name="type" /> specifies an invalid value.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="identity" /> is <see langword="null" />.
-or-
<paramref name="eventRights" /> is zero.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="identity" /> is neither of type <see cref="T:System.Security.Principal.SecurityIdentifier" /> nor of a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public EventWaitHandleAccessRule (string identity, System.Security.AccessControl.EventWaitHandleRights eventRights, System.Security.AccessControl.AccessControlType type);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string identity, valuetype System.Security.AccessControl.EventWaitHandleRights eventRights, valuetype System.Security.AccessControl.AccessControlType type) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Security.AccessControl.EventWaitHandleAccessRule.#ctor(System.String,System.Security.AccessControl.EventWaitHandleRights,System.Security.AccessControl.AccessControlType)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (identity As String, eventRights As EventWaitHandleRights, type As AccessControlType)" />
<MemberSignature Language="F#" Value="new System.Security.AccessControl.EventWaitHandleAccessRule : string * System.Security.AccessControl.EventWaitHandleRights * System.Security.AccessControl.AccessControlType -> System.Security.AccessControl.EventWaitHandleAccessRule" Usage="new System.Security.AccessControl.EventWaitHandleAccessRule (identity, eventRights, type)" />
<MemberSignature Language="C++ CLI" Value="public:
 EventWaitHandleAccessRule(System::String ^ identity, System::Security::AccessControl::EventWaitHandleRights eventRights, System::Security::AccessControl::AccessControlType type);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Threading.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="identity" Type="System.String" />
<Parameter Name="eventRights" Type="System.Security.AccessControl.EventWaitHandleRights" />
<Parameter Name="type" Type="System.Security.AccessControl.AccessControlType" />
</Parameters>
<Docs>
<param name="identity">The name of the user or group the rule applies to.</param>
<param name="eventRights">A bitwise combination of <see cref="T:System.Security.AccessControl.EventWaitHandleRights" /> values specifying the rights allowed or denied.</param>
<param name="type">One of the <see cref="T:System.Security.AccessControl.AccessControlType" /> values specifying whether the rights are allowed or denied.</param>
<summary>Initializes a new instance of the <see cref="T:System.Security.AccessControl.EventWaitHandleAccessRule" /> class, specifying the name of the user or group the rule applies to, the access rights, and whether the specified access rights are allowed or denied.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
To wait on an <xref:System.Threading.EventWaitHandle> (by calling the <xref:System.Threading.WaitHandle.WaitOne%2A>, <xref:System.Threading.WaitHandle.WaitAny%2A> or <xref:System.Threading.WaitHandle.WaitAll%2A> method), a user must have <xref:System.Security.AccessControl.EventWaitHandleRights.Synchronize?displayProperty=nameWithType> access. To signal an event by calling the <xref:System.Threading.EventWaitHandle.Set%2A> method, or to reset it to the unsignaled state by calling the <xref:System.Threading.EventWaitHandle.Reset%2A> method, a user must have <xref:System.Security.AccessControl.EventWaitHandleRights.Modify?displayProperty=nameWithType> access. To signal an <xref:System.Threading.EventWaitHandle> object and then wait on it by calling the <xref:System.Threading.WaitHandle.SignalAndWait%2A> method, a user must have <xref:System.Security.AccessControl.EventWaitHandleRights.Synchronize> and <xref:System.Security.AccessControl.EventWaitHandleRights.Modify> access.
This constructor is equivalent to creating an <xref:System.Security.Principal.NTAccount> object, by passing `identity` to the <xref:System.Security.Principal.NTAccount.%23ctor%28System.String%29?displayProperty=nameWithType> constructor, and passing the newly created <xref:System.Security.Principal.NTAccount> object to the <xref:System.Security.AccessControl.EventWaitHandleAccessRule.%23ctor%28System.Security.Principal.IdentityReference%2CSystem.Security.AccessControl.EventWaitHandleRights%2CSystem.Security.AccessControl.AccessControlType%29> constructor.
## Examples
The following code example demonstrates the use of this constructor to create <xref:System.Security.AccessControl.EventWaitHandleAccessRule> objects. The example creates an <xref:System.Security.AccessControl.EventWaitHandleSecurity> object, adds rules that allow and deny various rights for the current user, and displays the resulting pair of rules. The example then allows new rights for the current user and displays the result, showing that the new rights are merged with the existing <xref:System.Security.AccessControl.AccessControlType.Allow> rule.
> [!NOTE]
> This example does not attach the security object to a <xref:System.Threading.EventWaitHandle> object. Examples that attach security objects can be found in <xref:System.Threading.EventWaitHandle.GetAccessControl%2A?displayProperty=nameWithType> and <xref:System.Threading.EventWaitHandle.SetAccessControl%2A?displayProperty=nameWithType>.
:::code language="csharp" source="~/snippets/csharp/System.Security.AccessControl/EventWaitHandleAccessRule/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.AccessControl.EventWaitHandleSecurity.AddAccessRule/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="eventRights" /> specifies an invalid value.
-or-
<paramref name="type" /> specifies an invalid value.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="eventRights" /> is zero.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="identity" /> is <see langword="null" />.
-or-
<paramref name="identity" /> is a zero-length string.
-or-
<paramref name="identity" /> is longer than 512 characters.</exception>
</Docs>
</Member>
<Member MemberName="EventWaitHandleRights">
<MemberSignature Language="C#" Value="public System.Security.AccessControl.EventWaitHandleRights EventWaitHandleRights { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Security.AccessControl.EventWaitHandleRights EventWaitHandleRights" />
<MemberSignature Language="DocId" Value="P:System.Security.AccessControl.EventWaitHandleAccessRule.EventWaitHandleRights" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property EventWaitHandleRights As EventWaitHandleRights" />
<MemberSignature Language="F#" Value="member this.EventWaitHandleRights : System.Security.AccessControl.EventWaitHandleRights" Usage="System.Security.AccessControl.EventWaitHandleAccessRule.EventWaitHandleRights" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Security::AccessControl::EventWaitHandleRights EventWaitHandleRights { System::Security::AccessControl::EventWaitHandleRights get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Threading.AccessControl</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.3.0</AssemblyVersion>
<AssemblyVersion>4.0.4.0</AssemblyVersion>
<AssemblyVersion>4.0.5.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Security.AccessControl.EventWaitHandleRights</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the rights allowed or denied by the access rule.</summary>
<value>A bitwise combination of <see cref="T:System.Security.AccessControl.EventWaitHandleRights" /> values indicating the rights allowed or denied by the access rule.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Security.AccessControl.EventWaitHandleAccessRule> objects are immutable. You can create a new access rule representing a different user, different rights, or a different <xref:System.Security.AccessControl.AccessControlType>, but you cannot modify an existing access rule.
## Examples
The following code example demonstrates the use of the <xref:System.Security.AccessControl.EventWaitHandleAccessRule.EventWaitHandleRights%2A> property to display the rights in the set of rules contained in an <xref:System.Security.AccessControl.EventWaitHandleSecurity> object. The example creates an <xref:System.Security.AccessControl.EventWaitHandleSecurity> object, adds rules that allow and deny various rights for the current user, and displays the resulting pair of rules. The example then allows new rights for the current user and displays the result, showing that the new rights are merged with the existing <xref:System.Security.AccessControl.AccessControlType.Allow> rule.
> [!NOTE]
> This example does not attach the security object to a <xref:System.Threading.EventWaitHandle> object. Examples that attach security objects can be found in <xref:System.Threading.EventWaitHandle.GetAccessControl%2A?displayProperty=nameWithType> and <xref:System.Threading.EventWaitHandle.SetAccessControl%2A?displayProperty=nameWithType>.
:::code language="csharp" source="~/snippets/csharp/System.Security.AccessControl/EventWaitHandleAccessRule/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR_System/system.Security.AccessControl.EventWaitHandleSecurity.AddAccessRule/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>