diff --git a/ICD.Common.Utils/EventArguments/GenericEventArgs.cs b/ICD.Common.Utils/EventArguments/GenericEventArgs.cs index 895a067..9ed83a6 100644 --- a/ICD.Common.Utils/EventArguments/GenericEventArgs.cs +++ b/ICD.Common.Utils/EventArguments/GenericEventArgs.cs @@ -2,8 +2,11 @@ namespace ICD.Common.Utils.EventArguments { - public class GenericEventArgs : EventArgs + public class GenericEventArgs : EventArgs, IGenericEventArgs { + /// + /// Gets the wrapped data associated with the event. + /// public T Data { get; private set; } /// diff --git a/ICD.Common.Utils/EventArguments/IGenericEventArgs.cs b/ICD.Common.Utils/EventArguments/IGenericEventArgs.cs new file mode 100644 index 0000000..626a292 --- /dev/null +++ b/ICD.Common.Utils/EventArguments/IGenericEventArgs.cs @@ -0,0 +1,10 @@ +namespace ICD.Common.Utils.EventArguments +{ + public interface IGenericEventArgs + { + /// + /// Gets the wrapped data associated with the event. + /// + T Data { get; } + } +} diff --git a/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs b/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs index 958cf38..cb812b7 100644 --- a/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs +++ b/ICD.Common.Utils/Extensions/EventHandlerExtensions.cs @@ -14,6 +14,9 @@ namespace ICD.Common.Utils.Extensions /// 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(this EventHandler 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); } diff --git a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj index 63af157..8038e0b 100644 --- a/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj +++ b/ICD.Common.Utils/ICD.Common.Utils_SimplSharp.csproj @@ -81,6 +81,7 @@ + diff --git a/ICD.Common.Utils/ReprBuilder.cs b/ICD.Common.Utils/ReprBuilder.cs index 6204d52..481feae 100644 --- a/ICD.Common.Utils/ReprBuilder.cs +++ b/ICD.Common.Utils/ReprBuilder.cs @@ -3,6 +3,8 @@ using System.Text; namespace ICD.Common.Utils { + public delegate void AddReprPropertyDelegate(string name, object value); + /// /// Simple class for building a string representation of an object. /// diff --git a/ICD.Common.Utils/Timers/IcdStopwatch.cs b/ICD.Common.Utils/Timers/IcdStopwatch.cs index 1f9f398..c930671 100644 --- a/ICD.Common.Utils/Timers/IcdStopwatch.cs +++ b/ICD.Common.Utils/Timers/IcdStopwatch.cs @@ -140,6 +140,7 @@ namespace ICD.Common.Utils.Timers { using (IEnumerator enumerator = enumerable.GetEnumerator()) { +// ReSharper disable once AccessToDisposedClosure while (Profile(() => enumerator.MoveNext(), name)) yield return enumerator.Current; }