mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
feat: Adding simple IGenericEventArgs interface
This commit is contained in:
parent
9deafaec9b
commit
3da9b23e12
2 changed files with 19 additions and 4 deletions
|
|
@ -4,10 +4,17 @@ namespace ICD.Common.Utils.EventArguments
|
|||
{
|
||||
public class GenericEventArgs<T> : EventArgs, IGenericEventArgs<T>
|
||||
{
|
||||
private readonly T m_Data;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the wrapped data associated with the event.
|
||||
/// </summary>
|
||||
public T Data { get; private set; }
|
||||
object IGenericEventArgs.Data { get { return Data; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the wrapped data associated with the event.
|
||||
/// </summary>
|
||||
public T Data { get { return m_Data; } }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
|
|
@ -15,7 +22,7 @@ namespace ICD.Common.Utils.EventArguments
|
|||
/// <param name="data"></param>
|
||||
public GenericEventArgs(T data)
|
||||
{
|
||||
Data = data;
|
||||
m_Data = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,18 @@
|
|||
namespace ICD.Common.Utils.EventArguments
|
||||
{
|
||||
public interface IGenericEventArgs<T>
|
||||
public interface IGenericEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the wrapped data associated with the event.
|
||||
/// </summary>
|
||||
T Data { get; }
|
||||
object Data { get; }
|
||||
}
|
||||
|
||||
public interface IGenericEventArgs<T> : IGenericEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the wrapped data associated with the event.
|
||||
/// </summary>
|
||||
new T Data { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue