Class GorgonOption
An option to be stored in a IGorgonOptionBag.
Inherited Members
Namespace: Gorgon.Configuration
Assembly: Gorgon.Core.dll
Syntax
public class GorgonOption : GorgonNamedObject, IGorgonOption, IGorgonNamedObject
Properties
| Edit this page View SourceDescription
Property to return the friendly description of this option.
Declaration
public string Description { get; }
Property Value
Type | Description |
---|---|
string |
Text
Property to return text to display regarding this option.
Declaration
public string Text { get; }
Property Value
Type | Description |
---|---|
string |
Remarks
This is pulled from the first line of the Description.
Type
Property to return the type of data stored in the option.
Declaration
public Type Type { get; }
Property Value
Type | Description |
---|---|
Type |
Methods
| Edit this page View SourceCreateByteOption(string, byte, string, byte?, byte?)
Function to create an option that stores a byte value.
Declaration
public static IGorgonOption CreateByteOption(string name, byte defaultValue, string description = null, byte? minValue = null, byte? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
byte | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
byte? | minValue | [Optional] The minimum value for the option. |
byte? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateDateTimeOption(string, DateTime, string, DateTime?, DateTime?)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateDateTimeOption(string name, DateTime defaultValue, string description = null, DateTime? minValue = null, DateTime? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
DateTime | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
DateTime? | minValue | [Optional] The minimum value for the option. |
DateTime? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateDecimalOption(string, decimal, string, decimal?, decimal?)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateDecimalOption(string name, decimal defaultValue, string description = null, decimal? minValue = null, decimal? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
decimal | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
decimal? | minValue | [Optional] The minimum value for the option. |
decimal? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateDoubleOption(string, double, string, double?, double?)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateDoubleOption(string name, double defaultValue, string description = null, double? minValue = null, double? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
double | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
double? | minValue | [Optional] The minimum value for the option. |
double? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateInt16Option(string, short, string, short?, short?)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateInt16Option(string name, short defaultValue, string description = null, short? minValue = null, short? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
short | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
short? | minValue | [Optional] The minimum value for the option. |
short? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateInt32Option(string, int, string, int?, int?)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateInt32Option(string name, int defaultValue, string description, int? minValue = null, int? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
int | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
int? | minValue | [Optional] The minimum value for the option. |
int? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateInt64Option(string, long, string, long?, long?)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateInt64Option(string name, long defaultValue, string description = null, long? minValue = null, long? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
long | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
long? | minValue | [Optional] The minimum value for the option. |
long? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateOption<T>(string, T, string)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateOption<T>(string name, T defaultValue = default, string description = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
T | defaultValue | [Optional] The default value for the option. |
string | description | [Optional] The friendly description for this option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Type Parameters
Name | Description |
---|---|
T | The type of value to store. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
If the defaultValue
is omitted, then the default value for the type is used.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateOption<T>(string, T, T, string)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateOption<T>(string name, T value, T defaultValue, string description = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
T | value | The initial value to assign. |
T | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Type Parameters
Name | Description |
---|---|
T | The type of value to store. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateSByteOption(string, sbyte, string, sbyte?, sbyte?)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateSByteOption(string name, sbyte defaultValue, string description = null, sbyte? minValue = null, sbyte? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
sbyte | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
sbyte? | minValue | [Optional] The minimum value for the option. |
sbyte? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateSingleOption(string, float, string, float?, float?)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateSingleOption(string name, float defaultValue, string description = null, float? minValue = null, float? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
float | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
float? | minValue | [Optional] The minimum value for the option. |
float? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateUInt16Option(string, ushort, string, ushort?, ushort?)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateUInt16Option(string name, ushort defaultValue, string description = null, ushort? minValue = null, ushort? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
ushort | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
ushort? | minValue | [Optional] The minimum value for the option. |
ushort? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateUInt32Option(string, uint, string, uint?, uint?)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateUInt32Option(string name, uint defaultValue, string description = null, uint? minValue = null, uint? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
uint | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
uint? | minValue | [Optional] The minimum value for the option. |
uint? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
CreateUInt64Option(string, ulong, string, ulong?, ulong?)
Function to create an option that stores a signed byte value.
Declaration
public static IGorgonOption CreateUInt64Option(string name, ulong defaultValue, string description = null, ulong? minValue = null, ulong? maxValue = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the option. |
ulong | defaultValue | The default value for the option. |
string | description | [Optional] The friendly description for this option. |
ulong? | minValue | [Optional] The minimum value for the option. |
ulong? | maxValue | [Optional] The maximum value for the option. |
Returns
Type | Description |
---|---|
IGorgonOption | A new IGorgonOption. |
Remarks
The Text for this option is derived from the description
by using the first line of text (ended by a new line character). If the description
is a single line, then the Text and Description fields will be the same.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
GetDefaultValue<T>()
Function to retrieve the default value for this option.
Declaration
public T GetDefaultValue<T>()
Returns
Type | Description |
---|---|
T | The value, strongly typed. |
Type Parameters
Name | Description |
---|---|
T | The type of the value. |
GetMaxValue<T>()
Function to retrieve the maximum allowed value for this option.
Declaration
public T GetMaxValue<T>()
Returns
Type | Description |
---|---|
T | The value, strongly typed. |
Type Parameters
Name | Description |
---|---|
T | The type of the value. |
GetMinValue<T>()
Function to retrieve the minimum allowed value for this option.
Declaration
public T GetMinValue<T>()
Returns
Type | Description |
---|---|
T | The value, strongly typed. |
Type Parameters
Name | Description |
---|---|
T | The type of the value. |
GetValue<T>()
Function to retrieve the value stored in this option.
Declaration
public T GetValue<T>()
Returns
Type | Description |
---|---|
T | The value, strongly typed. |
Type Parameters
Name | Description |
---|---|
T | The type for the value. |
SetValue<T>(T)
Function to assign a value for the option.
Declaration
public void SetValue<T>(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to assign. |
Type Parameters
Name | Description |
---|---|
T | The type parmeter for the value. |