/// <summary> /// Includes the specified <paramref name="module"/> in the container. /// </summary> /// <param name="module"><see cref="DurianModule"/> to include.</param> /// <exception cref="ArgumentException"><paramref name="module"/> is not a valid <see cref="DurianModule"/> value.</exception> public void Include(DurianModule module) { if (!GlobalInfo.IsValidModuleValue(module)) { throw new ArgumentException($"Value '{module}' is not a valid {nameof(DurianModule)} value!", nameof(module)); } _enums.Add(module); _references.Add(null); }
/// <summary> /// Throws an <see cref="InvalidOperationException"/> if the specified <paramref name="module"/> is not a valid <see cref="DurianModule"/> value. /// </summary> /// <param name="module"><see cref="DurianModule"/> to ensure that is valid.</param> /// <exception cref="InvalidOperationException">Unknown <see cref="DurianModule"/> value detected. -or- <see cref="DurianModule.None"/> is not a valid Durian module.</exception> public static void EnsureIsValidModuleEnum(DurianModule module) { if (module == DurianModule.None) { throw new InvalidOperationException($"{nameof(DurianModule)}.{nameof(DurianModule.None)} is not a valid Durian module!"); } if (!GlobalInfo.IsValidModuleValue(module)) { throw new InvalidOperationException($"Unknown {nameof(DurianModule)} value: {module}!"); } }