mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-11 18:54:55 +00:00
Merge branch 'dev' of https://cs-gogs.icdpf.net/Common/Utils into dev
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
|
||||
namespace ICD.Common.Utils.EventArguments
|
||||
{
|
||||
public class GenericEventArgs<T> : EventArgs
|
||||
public class GenericEventArgs<T> : EventArgs, IGenericEventArgs<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the wrapped data associated with the event.
|
||||
/// </summary>
|
||||
public T Data { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
10
ICD.Common.Utils/EventArguments/IGenericEventArgs.cs
Normal file
10
ICD.Common.Utils/EventArguments/IGenericEventArgs.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace ICD.Common.Utils.EventArguments
|
||||
{
|
||||
public interface IGenericEventArgs<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the wrapped data associated with the event.
|
||||
/// </summary>
|
||||
T Data { get; }
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,9 @@ namespace ICD.Common.Utils.Extensions
|
||||
/// <param name="sender"></param>
|
||||
public static void Raise(this EventHandler extends, object sender)
|
||||
{
|
||||
if (sender == null)
|
||||
throw new ArgumentNullException("sender");
|
||||
|
||||
if (extends != null)
|
||||
extends(sender, EventArgs.Empty);
|
||||
}
|
||||
@@ -28,6 +31,12 @@ namespace ICD.Common.Utils.Extensions
|
||||
public static void Raise<T>(this EventHandler<T> extends, object sender, T args)
|
||||
where T : EventArgs
|
||||
{
|
||||
if (sender == null)
|
||||
throw new ArgumentNullException("sender");
|
||||
|
||||
if (args == null)
|
||||
throw new ArgumentNullException("args");
|
||||
|
||||
if (extends != null)
|
||||
extends(sender, args);
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
<Compile Include="EventArguments\DateTimeEventArgs.cs" />
|
||||
<Compile Include="EventArguments\FloatEventArgs.cs" />
|
||||
<Compile Include="EventArguments\GenericEventArgs.cs" />
|
||||
<Compile Include="EventArguments\IGenericEventArgs.cs" />
|
||||
<Compile Include="EventArguments\IntEventArgs.cs" />
|
||||
<Compile Include="EventArguments\StringEventArgs.cs" />
|
||||
<Compile Include="EventArguments\UShortEventArgs.cs" />
|
||||
|
||||
@@ -3,6 +3,8 @@ using System.Text;
|
||||
|
||||
namespace ICD.Common.Utils
|
||||
{
|
||||
public delegate void AddReprPropertyDelegate(string name, object value);
|
||||
|
||||
/// <summary>
|
||||
/// Simple class for building a string representation of an object.
|
||||
/// </summary>
|
||||
|
||||
@@ -140,6 +140,7 @@ namespace ICD.Common.Utils.Timers
|
||||
{
|
||||
using (IEnumerator<T> enumerator = enumerable.GetEnumerator())
|
||||
{
|
||||
// ReSharper disable once AccessToDisposedClosure
|
||||
while (Profile(() => enumerator.MoveNext(), name))
|
||||
yield return enumerator.Current;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user