-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRunModeAttribute.cs
More file actions
34 lines (31 loc) · 1.08 KB
/
RunModeAttribute.cs
File metadata and controls
34 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using Ultz.Extensions.Commands.Built;
namespace Ultz.Extensions.Commands.Attributes
{
/// <summary>
/// Sets a <see cref="RunMode" /> for the <see cref="Module" /> or <see cref="Command" />.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class RunModeAttribute : Attribute
{
/// <summary>
/// Initialises a new <see cref="RunModeAttribute" /> with the specified <see cref="RunMode" />.
/// </summary>
/// <param name="runMode"> The value to set. </param>
/// <exception cref="ArgumentOutOfRangeException">
/// Invalid run mode.
/// </exception>
public RunModeAttribute(RunMode runMode)
{
if (!Enum.IsDefined(typeof(RunMode), runMode))
{
throw new ArgumentOutOfRangeException(nameof(runMode), "Invalid run mode.");
}
Value = runMode;
}
/// <summary>
/// Gets the <see cref="RunMode" />.
/// </summary>
public RunMode Value { get; }
}
}