Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/libraries/System.Private.CoreLib/src/System/EventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,17 @@ namespace System
{
public delegate void EventHandler(object? sender, EventArgs e);

public delegate void EventHandler<TEventArgs>(object? sender, TEventArgs e); // Removed TEventArgs constraint post-.NET 4
public delegate void EventHandler<in TEventArgs>(object? sender, TEventArgs e) // Removed TEventArgs constraint post-.NET 4
where TEventArgs : allows ref struct;

/// <summary>
/// Represents the method that will handle an event when the event provides data.
/// </summary>
/// <typeparam name="TSender">The type of the object raising the event.</typeparam>
/// <typeparam name="TEventArgs">The type of the event data generated by the event.</typeparam>
/// <param name="sender">The source of the event.</param>
/// <param name="e">An object that contains the event data.</param>
public delegate void EventHandler<in TSender, in TEventArgs>(TSender sender, TEventArgs e)
where TSender : allows ref struct
where TEventArgs : allows ref struct;
}
3 changes: 2 additions & 1 deletion src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2789,7 +2789,8 @@ public partial class EventArgs
public EventArgs() { }
}
public delegate void EventHandler(object? sender, System.EventArgs e);
public delegate void EventHandler<TEventArgs>(object? sender, TEventArgs e);
public delegate void EventHandler<in TEventArgs>(object? sender, TEventArgs e) where TEventArgs : allows ref struct;
public delegate void EventHandler<in TSender, in TEventArgs>(TSender sender, TEventArgs e) where TSender : allows ref struct where TEventArgs : allows ref struct;
public partial class Exception : System.Runtime.Serialization.ISerializable
{
public Exception() { }
Expand Down
Loading