Skip to content

Commit 2e5843a

Browse files
authored
remove eventhandler example (#10741)
1 parent 061ce1a commit 2e5843a

File tree

2 files changed

+10
-23
lines changed

2 files changed

+10
-23
lines changed

xml/System/EventHandler.xml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,32 +78,22 @@
7878
<format type="text/markdown"><![CDATA[
7979
8080
## Remarks
81-
The event model in the .NET Framework is based on having an event delegate that connects an event with its handler. To raise an event, two elements are needed:
8281
83-
- A delegate that identifies the method that provides the response to the event.
82+
The event model in .NET is based on having an event delegate that connects an event with its handler. To raise an event, two elements are needed:
8483
85-
- Optionally, a class that holds the event data, if the event provides data.
84+
- A delegate that identifies the method that provides the response to the event.
85+
- Optionally, a class that holds the event data, if the event provides data.
8686
8787
The delegate is a type that defines a signature, that is, the return value type and parameter list types for a method. You can use the delegate type to declare a variable that can refer to any method with the same signature as the delegate.
8888
8989
The standard signature of an event handler delegate defines a method that does not return a value. This method's first parameter is of type <xref:System.Object> and refers to the instance that raises the event. Its second parameter is derived from type <xref:System.EventArgs> and holds the event data. If the event does not generate event data, the second parameter is simply the value of the <xref:System.EventArgs.Empty?displayProperty=nameWithType> field. Otherwise, the second parameter is a type derived from <xref:System.EventArgs> and supplies any fields or properties needed to hold the event data.
9090
91-
The <xref:System.EventHandler> delegate is a predefined delegate that specifically represents an event handler method for an event that does not generate data. If your event does generate data, you must use the generic <xref:System.EventHandler%601> delegate class.
91+
The <xref:System.EventHandler> delegate is a predefined delegate that specifically represents an event handler method for an event that does not generate data. If your event does generate data, you must use the generic <xref:System.EventHandler`1> delegate class.
9292
9393
To associate the event with the method that will handle the event, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate.
9494
9595
For more information about event handler delegates, see [Handling and Raising Events](/dotnet/standard/events/).
9696
97-
98-
99-
## Examples
100-
The following example shows an event named `ThresholdReached` that is associated with an <xref:System.EventHandler> delegate. The method assigned to the <xref:System.EventHandler> delegate is called in the `OnThresholdReached` method.
101-
102-
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp" id="Snippet6":::
103-
:::code language="csharp" source="~/snippets/csharp/System/EventArgs/Overview/programwithdata.cs" id="Snippet6":::
104-
:::code language="fsharp" source="~/snippets/fsharp/System/EventArgs/Overview/programwithdata.fs" id="Snippet6":::
105-
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/eventsoverview/vb/module1withdata.vb" id="Snippet6":::
106-
10797
]]></format>
10898
</remarks>
10999
<altmember cref="T:System.EventHandler`1" />
@@ -114,6 +104,5 @@
114104
<related type="Article" href="/dotnet/visual-basic/programming-guide/language-features/events/">Events (Visual Basic)</related>
115105
<related type="Article" href="/dotnet/csharp/programming-guide/events/">Events (C# Programming Guide)</related>
116106
<related type="Article" href="/dotnet/fsharp/language-reference/members/events/">Events (F#)</related>
117-
<related type="Article" href="https://learn.microsoft.com/previous-versions/windows/apps/hh758286(v=win.10)">Events and routed events overview (Windows store apps)</related>
118107
</Docs>
119108
</Type>

xml/System/EventHandler`1.xml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,26 +88,25 @@
8888
<format type="text/markdown"><![CDATA[
8989
9090
## Remarks
91-
The event model in the .NET Framework is based on having an event delegate that connects an event with its handler. To raise an event, two elements are needed:
9291
93-
- A delegate that refers to a method that provides the response to the event.
92+
The event model in .NET is based on having an event delegate that connects an event with its handler. To raise an event, two elements are needed:
9493
95-
- Optionally, a class that holds the event data, if the event provides data.
94+
- A delegate that refers to a method that provides the response to the event.
95+
- Optionally, a class that holds the event data, if the event provides data.
9696
9797
The delegate is a type that defines a signature, that is, the return value type and parameter list types for a method. You can use the delegate type to declare a variable that can refer to any method with the same signature as the delegate.
9898
9999
The standard signature of an event handler delegate defines a method that does not return a value. This method's first parameter is of type <xref:System.Object> and refers to the instance that raises the event. Its second parameter is derived from type <xref:System.EventArgs> and holds the event data. If the event does not generate event data, the second parameter is simply the value of the <xref:System.EventArgs.Empty?displayProperty=nameWithType> field. Otherwise, the second parameter is a type derived from <xref:System.EventArgs> and supplies any fields or properties needed to hold the event data.
100100
101-
The <xref:System.EventHandler%601> delegate is a predefined delegate that represents an event handler method for an event that generates data. The advantage of using <xref:System.EventHandler%601> is that you do not need to code your own custom delegate if your event generates event data. You simply provide the type of the event data object as the generic parameter.
101+
The <xref:System.EventHandler`1> delegate is a predefined delegate that represents an event handler method for an event that generates data. The advantage of using <xref:System.EventHandler`1> is that you don't need to code your own custom delegate if your event generates event data. You simply provide the type of the event data object as the generic parameter.
102102
103103
To associate the event with the method that will handle the event, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate.
104104
105105
For more information about event handler delegates, see [Handling and Raising Events](/dotnet/standard/events/).
106106
107-
108-
109107
## Examples
110-
The following example shows an event named `ThresholdReached`. The event is associated with an <xref:System.EventHandler%601> delegate.
108+
109+
The following example shows an event named `ThresholdReached`. The event is associated with an <xref:System.EventHandler`1> delegate.
111110
112111
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp" id="Snippet6":::
113112
:::code language="csharp" source="~/snippets/csharp/System/EventArgs/Overview/programwithdata.cs" id="Snippet6":::
@@ -125,6 +124,5 @@
125124
<related type="Article" href="/dotnet/visual-basic/programming-guide/language-features/events/">Events (Visual Basic)</related>
126125
<related type="Article" href="/dotnet/csharp/programming-guide/events/">Events (C# Programming Guide)</related>
127126
<related type="Article" href="/dotnet/fsharp/language-reference/members/events/">Events (F#)</related>
128-
<related type="Article" href="https://learn.microsoft.com/previous-versions/windows/apps/hh758286(v=win.10)">Events and routed events overview (Windows store apps)</related>
129127
</Docs>
130128
</Type>

0 commit comments

Comments
 (0)