Show / Hide Table of Contents

Class StringArgument

Argument implementation for working with string values

Inheritance
object
Argument<string>
StringArgument
DirectoryArgument
FileArgument
Implements
IArgument
Inherited Members
Argument<string>.OnInitialize()
Argument<string>.Description
Argument<string>.FriendlyName
Argument<string>.Value
Argument<string>.HasValue
Argument<string>.Name
Argument<string>.Alias
Argument<string>.HasAlias
Argument<string>.IsPositionalSource
Argument<string>.IsRequired
Argument<string>.AllowEmptyValue
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Benday.CommandsFramework
Assembly: Benday.CommandsFramework.dll
Syntax
public class StringArgument : Argument<string>, IArgument

Constructors

| Edit this page View Source

StringArgument(string)

Constructor. Creates an argument definition without a value. This is typically used in a command for describing the available arguments.

Declaration
public StringArgument(string name)
Parameters
Type Name Description
string name

Name of the argument on the command line

Properties

| Edit this page View Source

DataType

Data type for the argument

Declaration
public override ArgumentDataType DataType { get; }
Property Value
Type Description
ArgumentDataType
Overrides
Argument<string>.DataType

Methods

| Edit this page View Source

GetDefaultValue()

Get the default value for the argument

Declaration
protected override string GetDefaultValue()
Returns
Type Description
string

Empty string

Overrides
Argument<string>.GetDefaultValue()
| Edit this page View Source

TrySetValue(string)

Try to set a string value to this string argument

Declaration
public override bool TrySetValue(string input)
Parameters
Type Name Description
string input

Value as string

Returns
Type Description
bool

True if the value was successfully converted to string and set into the value

Overrides
Argument<string>.TrySetValue(string)
| Edit this page View Source

Validate()

Validate the argument value against the argument definition

Declaration
public override bool Validate()
Returns
Type Description
bool

True if the argument is valid

Overrides
Argument<string>.Validate()

Implements

IArgument

Extension Methods

ExtensionMethods.AllowEmptyValue<T>(Argument<T>, bool)
ExtensionMethods.AsNotRequired<T>(Argument<T>)
ExtensionMethods.AsRequired<T>(Argument<T>)
ExtensionMethods.ExistenceOptional<T>(Argument<T>)
ExtensionMethods.FromPositionalArgument<T>(Argument<T>, int)
ExtensionMethods.MustExist<T>(Argument<T>)
ExtensionMethods.WithAlias<T>(Argument<T>, string)
ExtensionMethods.WithDefaultValue<T>(Argument<T>, T)
ExtensionMethods.WithDescription<T>(Argument<T>, string)
ExtensionMethods.WithFriendlyName<T>(Argument<T>, string)
  • Edit this page
  • View Source
In this article
Back to top Copyright © www.benday.com | info@benday.com