-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Type of issue
Other (describe below)
Description
HI, I think the part of an article is incorrect.
The article in question is:
The Updated .NET Core Event Pattern
Please refer to text bolded by me which specifies the problematic info:
The previous article discussed the most common event patterns. .NET Core has a more relaxed pattern. In this version, the EventHandler definition no longer has the constraint that TEventArgs must be a class derived from System.EventArgs.
This increases flexibility for you, and is backwards compatible. Let's start with the flexibility. The class System.EventArgs introduces one method: MemberwiseClone(), which creates a shallow copy of the object. That method must use reflection in order to implement its functionality for any class derived from EventArgs. That functionality is easier to create in a specific derived class. That effectively means that deriving from System.EventArgs is a constraint that limits your designs, but does not provide any additional benefit.
The issue is that EventArgs class do not introduce MemberwiseClone(). System.Object does. Moreover if you look at the code of EventArgs this does not introduce any functionality. There is almost nothing there.
Please clarify or correct the article.
Page URL
https://learn.microsoft.com/en-us/dotnet/csharp/modern-events
Content source URL
https://github.com/dotnet/docs/blob/main/docs/csharp/modern-events.md
Document Version Independent Id
645a8a12-a026-bee9-7501-e8ec4a32ce31