feat: Adding simple IGenericEventArgs interface

This commit is contained in:
Chris Cameron
2020-06-03 16:14:43 -04:00
parent 9deafaec9b
commit 3da9b23e12
2 changed files with 19 additions and 4 deletions

View File

@@ -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;
}
}
}

View File

@@ -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; }
}
}