/// <summary> /// Gets the addon by key. /// </summary> /// <param name="addonBag">The <see cref="AddonBag"/>.</param> /// <param name="key">The key which uniquely identifies the addon.</param> /// <returns>The addon with specified key. <see langword="null" /> if no addon with specified key found.</returns> public static IAddon GetAddon(this AddonBag addonBag, object key) { return addonBag.GetAddon(key); }
/// <summary> /// Get the single or default addon in the <see cref="AddonBag"/> by type. /// </summary> /// <typeparam name="T">The type of the addon.</typeparam> /// <param name="addonBag">The <see cref="AddonBag"/>.</param> /// <returns>The addon with specified type, <see langword="null"/> if no addon found.</returns> /// <exception cref="InvalidOperationException">More than one addon of the specified type found.</exception> public static T GetAddon<T>(this AddonBag addonBag) where T : class, IAddon { return addonBag.GetAddon<T>(); }