using System; using System.Collections.Generic; using System.Linq; namespace Chernobyl.Event { /// /// An used by an event when that event is reporting /// something that affects the items contained within an instance of this /// class. /// public class ItemsEventArgs : EventArgs { /// /// Constructor /// /// The items that were affected by the event. public ItemsEventArgs(IEnumerable items) : this(items.ToArray()) {} /// /// Constructor /// /// The items that were affected by the event. public ItemsEventArgs(object[] items) { // Note: the "items" parameter above is not a "params" argument as // "params" arguments can be dangerous. See here for more info: // http://daniel.wertheim.se/2012/01/18/c-why-params-object-should-be-forbidden/ Items = items; } /// /// The items that were affected by the event. /// public object[] Items { get; protected set; } } /// /// An used by an event when that event is reporting /// something that affects the items contained within an instance of this /// class. This type is the generic version of . /// /// The type of the items being affected. public class ItemsEventArgs : ItemsEventArgs { /// /// Constructor /// /// The items that were affected by the event. public ItemsEventArgs(IEnumerable items) : this(items.ToArray()) {} /// /// Constructor /// /// The items that were affected by the event. public ItemsEventArgs(params T[] items) : base(items.Cast()) { Items = items; } /// /// The items that were affected by the event. /// public new T[] Items { get; protected set; } } }