![]() |
Arguments Class |
[SerializableAttribute] public class Arguments : IEnumerable<KeyValuePair<string, string>>, IEnumerable, ISerializable
The Arguments type exposes the following members.
Name | Description | |
---|---|---|
![]() | Arguments(String) | Initializes a new instance of the Arguments class. |
![]() | Arguments(SerializationInfo, StreamingContext) | Creates a new Arguments from serialization parameters. |
![]() | Arguments(String, Boolean) | Initializes a new instance of the Arguments class. |
![]() | Arguments(String, String) | Initializes a new instance of the Arguments class. |
![]() | Arguments(String, String, Boolean) | Initializes a new instance of the Arguments class. |
Name | Description | |
---|---|---|
![]() | ContainsHelpRequest | Gets a boolean value that indicates whether the command-line command contains request for displaying help. |
![]() | Count | Gets the total number of arguments (ordered and optional) present in the command-line command. |
![]() | InternalDictionary | Gets the dictionary containing all of the arguments present in the command-line command. |
![]() | Item | Gets the value for the specified argument from the command-line command. |
![]() | OrderedArgCount | Gets the total number of ordered arguments in the command-line command. |
![]() | OrderedArgID | Gets the prefix text in the identifier of ordered arguments present in the command-line command. |
![]() | OrderedArgs | Gets the ordered arguments as an array of strings. |
Name | Description | |
---|---|---|
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
![]() ![]() | Escape | Escapes a string so that it will be parsed as a single argument by the ToArgs(String) method. |
![]() | Exists | Gets a boolean value that indicates whether the specified argument is present in the command-line command. |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
![]() | GetEnumerator | Returns an IEnumerator for iterating through all the command-line command arguments. |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object) |
![]() | GetObjectData | Populates a SerializationInfo with the data needed to serialize the target object. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) |
![]() ![]() | ParseCommand | This function can be used to parse a single parameterized string and turn it into an array of parameters. |
![]() ![]() | ToArgs | Provides an array of arguments parsed from the given command using parsing rules similar to those used in POSIX environments. |
![]() | ToString |
Gets a string representation of the Arguments object.
(Overrides ObjectToString) |
![]() | TryGetValue | Gets the value associated with the specified argument in the command-line command. |
Name | Description | |
---|---|---|
![]() ![]() | DefaultOrderedArgID | Default value for OrderedArgID. |
![]() ![]() | TokenRegex | Regular expression pattern for tokenizing a list of arguments. |
Name | Description | |
---|---|---|
![]() | AllParallelKeyValuePairString, String |
Determines whether all elements of a sequence satisfy a condition with each item being tested in parallel.
(Defined by CollectionExtensions) |
![]() | DistinctByKeyValuePairString, String, TKey |
Returns only the elements whose keys are distinct.
(Defined by CollectionExtensions) |
![]() | GetEnumValueOrDefault |
Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) |
![]() | GetEnumValueOrDefaultT |
Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) |
![]() | MajorityKeyValuePairString, String |
Returns the majority value in the collection, or default type value if no item represents the majority.
(Defined by CollectionExtensions) |
![]() | MajorityKeyValuePairString, String |
Returns the majority value in the collection, or defaultValue if no item represents the majority.
(Defined by CollectionExtensions) |
![]() | MajorityByKeyValuePairString, String, TKey |
Returns the majority value in the collection, or default type value if no item represents the majority.
(Defined by CollectionExtensions) |
![]() | MajorityByKeyValuePairString, String, TKey |
Returns the majority value in the collection, or defaultValue if no item represents the majority.
(Defined by CollectionExtensions) |
![]() | MaxKeyValuePairString, String | Returns the largest item from the enumeration. (Defined by CollectionExtensions) |
![]() | MaxKeyValuePairString, String | Returns the largest item from the enumeration. (Defined by CollectionExtensions) |
![]() | MaxByKeyValuePairString, String, TKey | Selects the largest item from the enumeration. (Defined by CollectionExtensions) |
![]() | MedianKeyValuePairString, String |
Gets the median item(s) from an enumeration, i.e., one return item for odd lengths, two for even lengths.
(Defined by CollectionExtensions) |
![]() | MiddleKeyValuePairString, String |
Gets the middle item(s) from an enumeration, i.e., one return item for odd lengths, two for even lengths.
(Defined by CollectionExtensions) |
![]() | MinKeyValuePairString, String | Returns the smallest item from the enumeration. (Defined by CollectionExtensions) |
![]() | MinKeyValuePairString, String | Returns the smallest item from the enumeration. (Defined by CollectionExtensions) |
![]() | MinByKeyValuePairString, String, TKey | Selects the smallest item from the enumeration. (Defined by CollectionExtensions) |
![]() | MinorityKeyValuePairString, String |
Returns the minority value in the collection, or default type value if no item represents the minority.
(Defined by CollectionExtensions) |
![]() | MinorityKeyValuePairString, String |
Returns the minority value in the collection, or defaultValue if no item represents the minority.
(Defined by CollectionExtensions) |
![]() | MinorityByKeyValuePairString, String, TKey |
Returns the minority value in the collection, or default type value if no item represents the majority.
(Defined by CollectionExtensions) |
![]() | MinorityByKeyValuePairString, String, TKey |
Returns the minority value in the collection, or defaultValue if no item represents the majority.
(Defined by CollectionExtensions) |
![]() | StandardDeviationKeyValuePairString, String |
Computes the standard deviation over a sequence of Double values.
(Defined by NumericalAnalysisExtensions) |
![]() | StandardDeviationKeyValuePairString, String |
Computes the standard deviation over a sequence of Decimal values.
(Defined by NumericalAnalysisExtensions) |
![]() | StandardDeviationKeyValuePairString, String |
Computes the standard deviation over a sequence of Single values.
(Defined by NumericalAnalysisExtensions) |
![]() | ToDelimitedStringKeyValuePairString, String | Converts an enumeration to a string, using the default delimiter ("|") that can later be
converted back to a list using LoadDelimitedString. (Defined by CollectionExtensions) |
![]() | ToDelimitedStringKeyValuePairString, String | Converts an enumeration to a string that can later be converted back to a list using
LoadDelimitedString. (Defined by CollectionExtensions) |
![]() | ToDelimitedStringKeyValuePairString, String | Converts an enumeration to a string that can later be converted back to a list using
LoadDelimitedString. (Defined by CollectionExtensions) |
![]() | ToPagedListKeyValuePairString, String |
Gets a PagedListT to paginate source enumeration for
a given page and specified pageSize.
(Defined by CollectionExtensions) |
using System; using GSF; using GSF.Console; class Program { static void Main() { Arguments args = new Arguments("Sample.txt -wrap=true"); string file = args["OrderedArg1"]; bool wrapText = args["wrap"].ParseBoolean(); Console.WriteLine(string.Format("File: {0}", file)); Console.WriteLine(string.Format("Wrap text: {0}", wrapText)); Console.ReadLine(); } }
using System; using GSF.Console; class Program { static void Main() { // Environment.CommandLine = @"""c:\program files\tva\theme application\app.exe"" Document1.dcx -theme=default" Arguments args = new Arguments(Environment.CommandLine, true); string doc = args["OrderedArg1"]; string theme = args["theme"]; Console.WriteLine(string.Format("Document: {0}", doc)); Console.WriteLine(string.Format("Application theme: {0}", theme)); Console.ReadLine(); } }