C#

C#

Made by DeepSource

Classes that inherit EventArgs should be named appropriately CS-R1102

Anti-pattern
Major

The EventArgs class is a base class for classes that contain event data and provides a value to use for events that do not include event data. Classes that inherit this base class are usually named accordingly to signify that it deals with Event-related operations and entities such as "ThresholdReachedEventArgs". To put it in simpler terms, such classes' names should end with "EventArgs" — an unspoken naming convention.

Bad Practice

public class ThresholdReached : EventArgs
{
    public int Threshold { get; set; }
    public DateTime TimeReached { get; set; }
}

Recommended

// An example taken from Microsoft's docs.
public class ThresholdReachedEventArgs : EventArgs
{
    public int Threshold { get; set; }
    public DateTime TimeReached { get; set; }
}

Reference