This content is part of a third party extension that is not supported by the Cake project.
For more information about this extension see Cake.ArgumentBinder.
Summary
This class helps bind an enum to an argument. This allows one to limit
the choices a user is able to pass into the property.
- Assembly
- Cake
.ArgumentBinder .dll - Namespace
- Cake
.ArgumentBinder - Interfaces
- Base Types
-
- Attribute
- BaseAttribute
graph BT
Type-->Base0["BaseAttribute"]
click Base0 "/api/Cake.ArgumentBinder/BaseAttribute"
Base0-->Base1["Attribute"]
Type-.->Interface0["IReadOnlyArgumentAttribute"]
click Interface0 "/api/Cake.ArgumentBinder/IReadOnlyArgumentAttribute"
Type["EnumArgumentAttribute"]
class Type type-node
Syntax
public sealed class EnumArgumentAttribute : BaseAttribute, IReadOnlyArgumentAttribute
Remarks
Any enum can be used that follows the following rules. If any
of these rules are broken, the attribute will not validate,
and an exception will be thrown when the binding is attempted:
- The enum must contain at least one value within it.
Empty enums are not allowed.
- If
Required
is set to false,
the enum must have a value set to 0. 0 is the default value
for an enum, and its the only way we can define a default enum value
with Attribute
objects.
Constructors
Properties
Name | Value | Summary |
---|---|---|
ArgName | string |
The name of the argument that is passed in via the command-line.
Inherited from BaseAttribute
|
ArgumentSource | ArgumentSource |
Where to find the argument's value.
Inherited from BaseAttribute
|
BaseDefaultValue | object | |
Default |
ArgumentSource |
Inherited from BaseAttribute
static
|
DefaultValue | Enum |
The default value of the argument. This is set to the default
value of the enum, which is the value set to 0.
|
Description | string |
Description of what the argument does.
Inherited from BaseAttribute
|
HasSecretValue | bool |
Set to true if the value passed into the argument
should be hidden from any print-outs to the console.
Inherited from BaseAttribute
|
IgnoreCase | bool |
When parsing the enum values, ignore all casing.
This is defaulted to false.
If this is set to true, and there are two enum values that, when casing is ignored,
match, a validation error will happen.
|
Required | bool |
If the value is not specified, this will fail validation when this is set to true.
Inherited from BaseAttribute
|
Methods
Name | Value | Summary |
---|---|---|
ToString |
string | |
ToString |
void |
Appends this class's string representation to the passed
in string builder object.
This should be the first thing called when creating a ToString()
function of all child classes.
Inherited from BaseAttribute
|
Extension Methods
Name | Value | Summary |
---|---|---|
Dump |
string |
Get a basic string representation of specified object.
From LoggingExtensions
Requires the Cake.Incubator addin
|
IsIn |
bool |
Checks if the source is contained in a list
From EnumerableExtensions
Requires the Cake.Incubator addin
|
NotNull |
void |
Throws an exception if the specified parameter's value is null.
From Extensions
Requires the Cake.Ftp addin
|
NotNull |
void |
From IssuesArgumentChecks
Requires the Cake.Issues addin
|
ThrowIfNull |
T |
Throws a
System.ArgumentNullException with a specific message if the value is null, otherwise returns the value
From AssertExtensions
Requires the Cake.Incubator addin
|
ThrowIfNull |
T |
Throws a
System.ArgumentNullException if the value is null, otherwise returns the value
From AssertExtensions
Requires the Cake.Incubator addin
|
ToDictionary |
IDictionary |
From ObjectHelpers
Requires the Cake.DeployParams addin
|
To |
string |
From StringExtensions
Requires the Cake.Issues addin
|