diff --git a/CHANGELOG.md b/CHANGELOG.md
index eea8ad12..fd03d221 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,31 @@ All notable changes to this project will be documented in this file.
CommandLineParser project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [2.9.5] 2026-03-17
+
+###
+- got rid of the rest of the F# support
+- lots of ReSharper fixes
+
+## [2.9.4] 2026-03-17
+
+###
+- Lots of little ReSharper fixes
+- Ripped out most of the F# support
+
+## [2.9.3-unixwiz]
+
+###
+- Updated frameworks, went from "netstandard2.0;net40;net45;net461" to "net8.0".
+- Deleted LangVersion = 8.0 (way too old)
+
+## [2.9.2-unixwiz]
+
+###
+- First Unixwiz private build
+- Ensured that OptionAttribute and ValueAttribute classes are not sealed.
+- Started mucking w/ the package version stuff
+
## [2.9.0-preview2]
### Added
diff --git a/CommandLine.sln.DotSettings b/CommandLine.sln.DotSettings
new file mode 100644
index 00000000..f29b1d5f
--- /dev/null
+++ b/CommandLine.sln.DotSettings
@@ -0,0 +1,2 @@
+
+ True
\ No newline at end of file
diff --git a/README.md b/README.md
index 79a16fa7..99307738 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,19 @@
[](https://www.nuget.org/packages/CommandLineParser/)
[](https://gitter.im/gsscoder/commandline?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+# Unixwiz.net update
+
+This is a private, independently-maintained fork of the excellent CommandLineParser package
+for modern .NET applications, and has dropped support for anything but recent .NET versions.
+We have an application that required a change - un-sealing the "OptionValue" and "ValueAttribute"
+classes - and needed to share this with a small circle of customers.
+
+Sorry, FSharp and .netstandard support has been removed. The docs below will be edited at some
+point to ensure that this README.md is not lying.
+
+Do not enable `GeneratePackageOnBuild` - it interferes with expected behavior of `dotnet pack -c Release`
+after a clean build and caused missing-output packaging failures.
+
# Command Line Parser Library for CLR and NetStandard
**Note:** the API surface has changed since v1.9.x and earlier. If you are looking for documentation on v1.9.x, please see [stable-1.9.71.2](https://github.com/gsscoder/commandline/tree/stable-1.9.71.2)
@@ -16,7 +29,7 @@ C:\Project> NuGet Install CommandLineParser
# Nightly Build
-Nightly version of the CommandLineParser can be downloaded from github [Releases](https://github.com/commandlineparser/commandline/releases).
+Nightly version of the CommandLineParser can be downloaded from github [Releases](https://github.com/commandlineparser/commandline/releases).
The Last new features and fixes, read [changelog](https://github.com/commandlineparser/commandline/blob/master/CHANGELOG.md)
@@ -118,7 +131,7 @@ class Options
Default = false,
HelpText = "Prints all messages to standard output.")]
public bool Verbose { get; set; }
-
+
[Option("stdin",
Default = false,
HelpText = "Read from stdin")]
@@ -207,7 +220,7 @@ End Sub
## For verbs:
-1. Create separate option classes for each verb. An options base class is supported.
+1. Create separate option classes for each verb. An options base class is supported.
2. Call ParseArguments with all the verb attribute decorated options classes.
3. Use MapResult to direct program flow to the verb that was parsed.
@@ -313,9 +326,9 @@ let main args =
See the [changelog](CHANGELOG.md)
# Contributors
-First off, _Thank you!_ All contributions are welcome.
+First off, _Thank you!_ All contributions are welcome.
-Please consider sticking with the GNU getopt standard for command line parsing.
+Please consider sticking with the GNU getopt standard for command line parsing.
Additionally, for easiest diff compares, please follow the project's tabs settings. Utilizing the EditorConfig extension for Visual Studio/your favorite IDE is recommended.
@@ -346,6 +359,6 @@ __And most importantly, please target the ```develop``` branch in your pull requ
- Eric Newton
- ericnewton76+commandlineparser AT gmail DOT com
- GitHub: [ericnewton76](https://github.com/ericnewton76)
- - Blog:
+ - Blog:
- Twitter: [enorl76](http://twitter.com/enorl76)
-- Moh-Hassan
+- Moh-Hassan
diff --git a/src/CommandLine/BaseAttribute.cs b/src/CommandLine/BaseAttribute.cs
index be0a3826..88be9324 100644
--- a/src/CommandLine/BaseAttribute.cs
+++ b/src/CommandLine/BaseAttribute.cs
@@ -11,7 +11,6 @@ public abstract class BaseAttribute : Attribute
{
private int min;
private int max;
- private object @default;
private Infrastructure.LocalizableAttributeProperty helpText;
private string metaValue;
private Type resourceType;
@@ -44,12 +43,12 @@ public bool Required
/// If not set, no lower range is enforced.
public int Min
{
- get { return min; }
+ get => min;
set
{
if (value < 0)
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
min = value;
@@ -63,12 +62,12 @@ public int Min
/// If not set, no upper range is enforced.
public int Max
{
- get { return max; }
+ get => max;
set
{
if (value < 0)
{
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
max = value;
@@ -78,14 +77,7 @@ public int Max
///
/// Gets or sets mapped property default value.
///
- public object Default
- {
- get { return @default; }
- set
- {
- @default = value;
- }
- }
+ public object Default { get; set; }
///
/// Gets or sets a short description of this command line option. Usually a sentence summary.
@@ -93,7 +85,7 @@ public object Default
public string HelpText
{
get => helpText.Value??string.Empty;
- set => helpText.Value = value ?? throw new ArgumentNullException("value");
+ set => helpText.Value = value ?? throw new ArgumentNullException(nameof(value));
}
///
@@ -101,16 +93,8 @@ public string HelpText
///
public string MetaValue
{
- get { return metaValue; }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException("value");
- }
-
- metaValue = value;
- }
+ get => metaValue;
+ set => metaValue = value ?? throw new ArgumentNullException(nameof(value));
}
///
@@ -127,12 +111,8 @@ public bool Hidden
///
public Type ResourceType
{
- get { return resourceType; }
- set
- {
- resourceType =
- helpText.ResourceType = value;
- }
+ get => resourceType;
+ set => resourceType = helpText.ResourceType = value;
}
}
}
diff --git a/src/CommandLine/CommandLine.csproj b/src/CommandLine/CommandLine.csproj
index 04496eb8..bc7d2cd4 100644
--- a/src/CommandLine/CommandLine.csproj
+++ b/src/CommandLine/CommandLine.csproj
@@ -3,36 +3,29 @@
CommandLineLibrary
- netstandard2.0;net40;net45;net461
+ net8.0$(DefineConstants);CSX_EITHER_INTERNAL;CSX_REM_EITHER_BEYOND_2;CSX_ENUM_INTERNAL;ERRH_INTERNAL;CSX_MAYBE_INTERNAL;CSX_REM_EITHER_FUNC;CSX_REM_CRYPTORAND;ERRH_ADD_MAYBE_METHODS
- $(DefineConstants);SKIP_FSHARPtrue..\..\CommandLine.snktrue
- CommandLineParser
- CommandLineParser.FSharp
- gsscoder;nemec;ericnewton76;moh-hassan
- Command Line Parser Library
+ Unixwiz.CommandLineParser
+ gsscoder;nemec;ericnewton76;moh-hassan;SJFriedl
+ Command Line Parser Library - Unixwiz.net fork$(VersionSuffix)
- 0.0.0
- Terse syntax C# command line parser for .NET. For FSharp support see CommandLineParser.FSharp. The Command Line Parser Library offers to CLR applications a clean and concise API for manipulating command line arguments and related tasks.
- Terse syntax C# command line parser for .NET with F# support. The Command Line Parser Library offers to CLR applications a clean and concise API for manipulating command line arguments and related tasks.
+ 2.9.5
+ Terse syntax C# command line parser for .NET. The Command Line Parser Library offers to CLR applications a clean and concise API for manipulating command line arguments and related tasks.Copyright (c) 2005 - 2020 Giacomo Stelluti Scala & ContributorsLicense.mdCommandLine20.png
- https://github.com/commandlineparser/commandline
+ https://github.com/SJFriedl/commandlinecommand line;commandline;argument;option;parser;parsing;library;syntax;shell
- https://github.com/commandlineparser/commandline/blob/master/CHANGELOG.md
- true
- 8.0
+ https://github.com/SJFriedl/commandline/blob/master/CHANGELOG.md
+ Falsetruesnupkg
+ Unixwiz.CommandLineParser
-
-
-
-
true
@@ -40,12 +33,6 @@
-
-
-
-
-
-
diff --git a/src/CommandLine/Core/GetoptTokenizer.cs b/src/CommandLine/Core/GetoptTokenizer.cs
index b8c97fc2..0c1dc24e 100644
--- a/src/CommandLine/Core/GetoptTokenizer.cs
+++ b/src/CommandLine/Core/GetoptTokenizer.cs
@@ -3,10 +3,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using CommandLine.Infrastructure;
using CSharpx;
using RailwaySharp.ErrorHandling;
-using System.Text.RegularExpressions;
namespace CommandLine.Core
{
@@ -145,7 +143,7 @@ private static IEnumerable TokenizeShortName(
// First option char that requires a value means we swallow the rest of the string as the value
// But if there is no rest of the string, then instead we swallow the next argument
- string chars = arg.Substring(1);
+ string chars = arg[1..];
int len = chars.Length;
if (len > 0 && Char.IsDigit(chars[0]))
{
@@ -164,7 +162,7 @@ private static IEnumerable TokenizeShortName(
if (i+1 < len)
{
// Rest of this is the value (e.g. "-sfoo" where "-s" is a string-consuming arg)
- yield return Token.Value(chars.Substring(i+1));
+ yield return Token.Value(chars[(i+1)..]);
yield break;
}
else
@@ -192,7 +190,7 @@ private static IEnumerable TokenizeLongName(
Action onUnknownOption,
Action onConsumeNext)
{
- string[] parts = arg.Substring(2).Split(new char[] { '=' }, 2);
+ string[] parts = arg[2..].Split(new char[] { '=' }, 2);
string name = parts[0];
string value = (parts.Length > 1) ? parts[1] : null;
// A parameter like "--stringvalue=" is acceptable, and makes stringvalue be the empty string
diff --git a/src/CommandLine/Core/InstanceBuilder.cs b/src/CommandLine/Core/InstanceBuilder.cs
index f48127b1..10137e26 100644
--- a/src/CommandLine/Core/InstanceBuilder.cs
+++ b/src/CommandLine/Core/InstanceBuilder.cs
@@ -94,7 +94,7 @@ public static ParserResult Build(
var valueSpecPropsResult =
ValueMapper.MapValues(
(from pt in specProps where pt.Specification.IsValue() orderby ((ValueSpecification)pt.Specification).Index select pt),
- valuesPartition,
+ valuesPartition,
(vals, type, isScalar) => TypeConverter.ChangeType(vals, type, isScalar, false, parsingCulture, ignoreValueCase));
var missingValueErrors = from token in errorsPartition
@@ -110,7 +110,7 @@ public static ParserResult Build(
//build the instance, determining if the type is mutable or not.
T instance;
- if(typeInfo.IsMutable() == true)
+ if (typeInfo.IsMutable() == true)
{
instance = BuildMutable(factory, specPropsWithValue, setPropertyErrors);
}
@@ -156,8 +156,8 @@ private static T BuildMutable(Maybe> factory, IEnumerable sp.Value.IsJust(),
+ specPropsWithValue,
+ sp => sp.Value.IsJust(),
sp => sp.Value.FromJustOrFail()
)
);
@@ -173,8 +173,8 @@ private static T BuildMutable(Maybe> factory, IEnumerable sp.Value.IsNothing()
- && sp.Specification.TargetType == TargetType.Sequence
+ sp => sp.Value.IsNothing()
+ && sp.Specification.TargetType == TargetType.Sequence
&& sp.Specification.DefaultValue.MatchNothing(),
sp => sp.Property.PropertyType.GetTypeInfo().GetGenericArguments().Single().CreateEmptyArray()
)
@@ -189,7 +189,7 @@ private static T BuildImmutable(Type typeInfo, Maybe> factory, IEnume
specProps.Select(sp => sp.Property.PropertyType).ToArray()
);
- if(ctor == null)
+ if (ctor == null)
{
throw new InvalidOperationException($"Type {typeInfo.FullName} appears to be immutable, but no constructor found to accept values.");
}
diff --git a/src/CommandLine/Core/InstanceChooser.cs b/src/CommandLine/Core/InstanceChooser.cs
index 72307bf2..97258cab 100644
--- a/src/CommandLine/Core/InstanceChooser.cs
+++ b/src/CommandLine/Core/InstanceChooser.cs
@@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
-using CommandLine.Infrastructure;
using CSharpx;
using RailwaySharp.ErrorHandling;
@@ -141,7 +140,7 @@ private static ParserResult
public static TResult Fold(this IEnumerable source, Func folder)
@@ -194,7 +194,7 @@ public static TResult Fold(this IEnumerable source, Func
- /// Returns the result of applying a function to a sequence of
+ /// Returns the result of applying a function to a sequence of
/// 3 elements.
///
public static TResult Fold(this IEnumerable source, Func folder)
@@ -203,7 +203,7 @@ public static TResult Fold(this IEnumerable source, Func
- /// Returns the result of applying a function to a sequence of
+ /// Returns the result of applying a function to a sequence of
/// 4 elements.
///
public static TResult Fold(this IEnumerable source, Func folder)
@@ -265,10 +265,10 @@ public static void ForEach(this IEnumerable source, Action action)
}
///
- /// Returns a sequence resulting from applying a function to each
- /// element in the source sequence and its
- /// predecessor, with the exception of the first element which is
- /// only returned as the predecessor of the second element.
+ /// Returns a sequence resulting from applying a function to each
+ /// element in the source sequence and its /predecessor, except
+ /// the first element which is /only returned as the
+ /// predecessor of the second element.
///
public static IEnumerable Pairwise(this IEnumerable source, Func resultSelector)
{
@@ -297,7 +297,7 @@ private static IEnumerable PairwiseImpl(this IEnumera
}
///
- /// Creates a delimited string from a sequence of values. The
+ /// Creates a delimited string from a sequence of values. The
/// delimiter used depends on the current culture of the executing thread.
///
public static string ToDelimitedString(this IEnumerable source)
@@ -384,14 +384,9 @@ public static IEnumerable Materialize(this IEnumerable source)
return new MaterializedEnumerable(source);
}
- private class MaterializedEnumerable : IEnumerable
+ private class MaterializedEnumerable(IEnumerable enumerable) : IEnumerable
{
- private readonly ICollection inner;
-
- public MaterializedEnumerable(IEnumerable enumerable)
- {
- inner = enumerable as ICollection ?? enumerable.ToArray();
- }
+ private readonly ICollection inner = enumerable as ICollection ?? enumerable.ToArray();
public IEnumerator GetEnumerator()
{
@@ -418,7 +413,7 @@ public static T Choice(this IEnumerable source)
}
///
- /// Takes an element and a sequence and `intersperses' that element between its elements.
+ /// Takes an element and a sequence and "intersperses" that element between its elements.
///
public static IEnumerable Intersperse(this IEnumerable source, T element)
{
@@ -447,7 +442,7 @@ public static IEnumerable FlattenOnce(this IEnumerable> sou
}
///
- /// Reduces a sequence of strings to a sequence of parts, splitted by space,
+ /// Reduces a sequence of strings to a sequence of parts, split by space,
/// of each original string.
///
public static IEnumerable FlattenOnce(this IEnumerable source)
@@ -460,4 +455,4 @@ public static IEnumerable FlattenOnce(this IEnumerable source)
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/CommandLine/Infrastructure/CSharpx/Maybe.cs b/src/CommandLine/Infrastructure/CSharpx/Maybe.cs
index 044bb681..d74f2649 100644
--- a/src/CommandLine/Infrastructure/CSharpx/Maybe.cs
+++ b/src/CommandLine/Infrastructure/CSharpx/Maybe.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
+// ReSharper disable once CheckNamespace
namespace CSharpx
{
#region Maybe Type
@@ -21,25 +22,18 @@ enum MaybeType
}
///
- /// The Maybe type models an optional value. A value of type Maybe a either contains a value of type a (represented as Just a),
+ /// The Maybe type models an optional value. A value of type Maybe either contains a value of type a (represented as Just a),
/// or it is empty (represented as Nothing).
///
#if !CSX_MAYBE_INTERNAL
public
#endif
- abstract class Maybe
+ abstract class Maybe(MaybeType tag)
{
- private readonly MaybeType tag;
-
- protected Maybe(MaybeType tag)
- {
- this.tag = tag;
- }
-
///
/// Type discriminator.
///
- public MaybeType Tag { get { return tag; } }
+ public MaybeType Tag { get; } = tag;
#region Basic Match Methods
///
@@ -68,7 +62,7 @@ public bool MatchNothing()
#if !CSX_MAYBE_INTERNAL
public
#endif
- sealed class Nothing : Maybe
+ sealed class Nothing : Maybe
{
internal Nothing()
: base(MaybeType.Nothing)
@@ -82,23 +76,18 @@ internal Nothing()
#if !CSX_MAYBE_INTERNAL
public
#endif
- sealed class Just : Maybe
+ sealed class Just : Maybe
{
- private readonly T value;
-
internal Just(T value)
: base(MaybeType.Just)
{
- this.value = value;
+ this.Value = value;
}
///
/// The wrapped value.
///
- public T Value
- {
- get { return value; }
- }
+ public T Value { get; }
}
///
@@ -141,30 +130,26 @@ public static Maybe Return(T value)
///
public static Maybe Bind(Maybe maybe, Func> func)
{
- T1 value1;
- return maybe.MatchJust(out value1) ? func(value1) : Maybe.Nothing();
+ return maybe.MatchJust(out var value1) ? func(value1) : Maybe.Nothing();
}
#endregion
#region Functor
///
- /// Transforms an maybe value by using a specified mapping function.
+ /// Transforms a Maybe value by using a specified mapping function.
///
public static Maybe Map(Maybe maybe, Func func)
{
- T1 value1;
- return maybe.MatchJust(out value1) ? Maybe.Just(func(value1)) : Maybe.Nothing();
+ return maybe.MatchJust(out var value1) ? Maybe.Just(func(value1)) : Maybe.Nothing();
}
#endregion
///
- /// If both maybes contain a value, it merges them into a maybe with a tupled value.
+ /// If both Maybes contain a value, it merges them into a Maybe with a tupled value.
///
public static Maybe> Merge(Maybe first, Maybe second)
{
- T1 value1;
- T2 value2;
- if (first.MatchJust(out value1) && second.MatchJust(out value2)) {
+ if (first.MatchJust(out var value1) && second.MatchJust(out var value2)) {
return Maybe.Just(Tuple.Create(value1, value2));
}
return Maybe.Nothing>();
@@ -198,8 +183,7 @@ static class MaybeExtensions
///
public static void Match(this Maybe maybe, Action ifJust, Action ifNothing)
{
- T value;
- if (maybe.MatchJust(out value)) {
+ if (maybe.MatchJust(out var value)) {
ifJust(value);
return;
}
@@ -211,9 +195,7 @@ public static void Match(this Maybe maybe, Action ifJust, Action ifNoth
///
public static void Match(this Maybe> maybe, Action ifJust, Action ifNothing)
{
- T1 value1;
- T2 value2;
- if (maybe.MatchJust(out value1, out value2)) {
+ if (maybe.MatchJust(out var value1, out var value2)) {
ifJust(value1, value2);
return;
}
@@ -225,8 +207,7 @@ public static void Match(this Maybe> maybe, Action
///
public static bool MatchJust(this Maybe> maybe, out T1 value1, out T2 value2)
{
- Tuple value;
- if (maybe.MatchJust(out value)) {
+ if (maybe.MatchJust(out var value)) {
value1 = value.Item1;
value2 = value.Item2;
return true;
@@ -294,27 +275,24 @@ public static Maybe SelectMany(
///
public static void Do(this Maybe maybe, Action action)
{
- T value;
- if (maybe.MatchJust(out value)) {
+ if (maybe.MatchJust(out var value)) {
action(value);
}
}
///
- /// If contans a value executes an delegate over it.
+ /// If contains a value executes an delegate over it.
///
public static void Do(this Maybe> maybe, Action action)
{
- T1 value1;
- T2 value2;
- if (maybe.MatchJust(out value1, out value2)) {
+ if (maybe.MatchJust(out var value1, out var value2)) {
action(value1, value2);
}
}
#endregion
///
- /// Returns true iffits argument is of the form .
+ /// Returns true if its argument is of the form .
///
public static bool IsJust(this Maybe maybe)
{
@@ -322,7 +300,7 @@ public static bool IsJust(this Maybe maybe)
}
///
- /// Returns true iffits argument is of the form .
+ /// Returns true if its argument is of the form .
///
public static bool IsNothing(this Maybe maybe)
{
@@ -334,8 +312,7 @@ public static bool IsNothing(this Maybe maybe)
///
public static T FromJust(this Maybe maybe)
{
- T value;
- if (maybe.MatchJust(out value)) {
+ if (maybe.MatchJust(out var value)) {
return value;
}
return default(T);
@@ -346,8 +323,7 @@ public static T FromJust(this Maybe maybe)
///
public static T FromJustOrFail(this Maybe maybe, Exception exceptionToThrow = null)
{
- T value;
- if (maybe.MatchJust(out value)) {
+ if (maybe.MatchJust(out var value)) {
return value;
}
throw exceptionToThrow ?? new ArgumentException("Value empty.");
@@ -358,8 +334,7 @@ public static T FromJustOrFail(this Maybe maybe, Exception exceptionToThro
///
public static T GetValueOrDefault(this Maybe maybe, T noneValue)
{
- T value;
- return maybe.MatchJust(out value) ? value : noneValue;
+ return maybe.MatchJust(out var value) ? value : noneValue;
}
///
@@ -367,16 +342,14 @@ public static T GetValueOrDefault(this Maybe maybe, T noneValue)
///
public static T2 MapValueOrDefault(this Maybe maybe, Func func, T2 noneValue)
{
- T1 value1;
- return maybe.MatchJust(out value1) ? func(value1) : noneValue;
+ return maybe.MatchJust(out var value1) ? func(value1) : noneValue;
}
///
/// If contains a values executes a mapping function over it, otherwise returns the value from .
///
public static T2 MapValueOrDefault(this Maybe maybe, Func func, Func noneValueFactory) {
- T1 value1;
- return maybe.MatchJust(out value1) ? func(value1) : noneValueFactory();
+ return maybe.MatchJust(out var value1) ? func(value1) : noneValueFactory();
}
///
@@ -384,11 +357,10 @@ public static T2 MapValueOrDefault(this Maybe maybe, Func fu
///
public static IEnumerable ToEnumerable(this Maybe maybe)
{
- T value;
- if (maybe.MatchJust(out value)) {
+ if (maybe.MatchJust(out var value)) {
return Enumerable.Empty().Concat(new[] { value });
}
return Enumerable.Empty();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/CommandLine/Infrastructure/ErrorHandling.cs b/src/CommandLine/Infrastructure/ErrorHandling.cs
index 8aee4bac..553d2424 100644
--- a/src/CommandLine/Infrastructure/ErrorHandling.cs
+++ b/src/CommandLine/Infrastructure/ErrorHandling.cs
@@ -10,6 +10,7 @@
using CSharpx;
#endif
+// ReSharper disable once CheckNamespace
namespace RailwaySharp.ErrorHandling
{
#if !ERRH_INTERNAL
@@ -25,23 +26,13 @@ enum ResultType
/// Represents the result of a computation.
///
/// Type that models the result of a successful computation.
- /// Type that model a message related to a computation.
+ /// Type that model a message related to a computation.
#if !ERRH_INTERNAL
public
-#endif
- abstract class Result
+#endif
+ abstract class Result(ResultType tag)
{
- private readonly ResultType _tag;
-
- protected Result(ResultType tag)
- {
- _tag = tag;
- }
-
- public ResultType Tag
- {
- get { return _tag; }
- }
+ public ResultType Tag { get; } = tag;
public override string ToString()
{
@@ -65,10 +56,10 @@ public override string ToString()
/// Represents the result of a successful computation.
///
/// Type that models the result of a successful computation.
- /// Type that model a message related to a computation.
+ /// Type that model a message related to a computation.
#if !ERRH_INTERNAL
public
-#endif
+#endif
sealed class Ok : Result
{
private readonly Tuple> _value;
@@ -81,41 +72,22 @@ public Ok(TSuccess success, IEnumerable messages)
_value = Tuple.Create(success, messages);
}
- public TSuccess Success
- {
- get { return _value.Item1; }
- }
+ public TSuccess Success => _value.Item1;
- public IEnumerable Messages
- {
- get { return _value.Item2; }
- }
+ public IEnumerable Messages => _value.Item2;
}
///
/// Represents the result of a failed computation.
///
/// Type that models the result of a successful computation.
- /// Type that model a message related to a computation.
+ /// Type that model a message related to a computation.
#if !ERRH_INTERNAL
public
#endif
- sealed class Bad : Result
+ sealed class Bad(IEnumerable messages) : Result(ResultType.Bad)
{
- private readonly IEnumerable _messages;
-
- public Bad(IEnumerable messages)
- : base(ResultType.Bad)
- {
- if (messages == null) throw new ArgumentException(nameof(messages));
-
- _messages = messages;
- }
-
- public IEnumerable Messages
- {
- get { return _messages; }
- }
+ public IEnumerable Messages { get; } = messages ?? throw new ArgumentException(nameof(messages));
}
#if !ERRH_INTERNAL
@@ -267,8 +239,7 @@ public static TResult Either(
if (successFunc == null) throw new ArgumentException(nameof(successFunc));
if (failureFunc == null) throw new ArgumentException(nameof(failureFunc));
- var ok = trialResult as Ok;
- if (ok != null) {
+ if (trialResult is Ok ok) {
return successFunc(ok.Success, ok.Messages);
}
var bad = (Bad)trialResult;
@@ -276,8 +247,8 @@ public static TResult Either(
}
///
- /// If the given result is a Success the wrapped value will be returned.
- /// Otherwise the function throws an exception with Failure message of the result.
+ /// If the given result is a Success the wrapped value will be returned.
+ /// Otherwise, the function throws an exception with Failure message of the result.
///
#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -319,7 +290,7 @@ public static Result MergeMessages(
///
/// If the result is a Success it executes the given function on the value.
- /// Otherwise the exisiting failure is propagated.
+ /// Otherwise, the existing failure is propagated.
///
#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -350,10 +321,10 @@ public static Result Flatten(
{
return Bind(x => x, result);
}
-
+
///
- /// If the wrapped function is a success and the given result is a success the function is applied on the value.
- /// Otherwise the exisiting error messages are propagated.
+ /// If the wrapped function is a success and the given result is a success the function is applied on the value.
+ /// Otherwise, the existing error messages are propagated.
///
#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -423,7 +394,7 @@ public static Result, TMessage> Collect, Result, TMessage>, Result, TMessage>>(
- null,
+ null,
(result, next) => {
if (result.Tag == ResultType.Ok && next.Tag == ResultType.Ok) {
var ok1 = (Ok, TMessage>)result;
@@ -445,7 +416,7 @@ public static Result, TMessage> Collect, TMessage>)result;
- var bad2 = (Bad)next;
+ var bad2 = (Bad)next;
return new Bad, TMessage>(bad1.Messages.Concat(bad2.Messages));
}, x => x));
}
@@ -472,8 +443,7 @@ public static void Match(this Result res
if (ifSuccess == null) throw new ArgumentException(nameof(ifSuccess));
if (ifFailure == null) throw new ArgumentException(nameof(ifFailure));
- var ok = result as Ok;
- if (ok != null) {
+ if (result is Ok ok) {
ifSuccess(ok.Success, ok.Messages);
return;
}
@@ -546,7 +516,7 @@ public static Result, TMessage> Flatten
/// If the result is a Success it executes the given Func on the value.
- /// Otherwise the exisiting failure is propagated.
+ /// Otherwise, the existing failure is propagated.
///
#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -560,7 +530,7 @@ public static Result SelectMany(
///
/// If the result is a Success it executes the given Func on the value.
/// If the result of the Func is a Success it maps it using the given Func.
- /// Otherwise the exisiting failure is propagated.
+ /// Otherwise, the existing failure is propagated.
///
#if ERRH_ENABLE_INLINE_METHODS
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -633,7 +603,7 @@ public static TSuccess SucceededWith(this Result
- /// Returns messages in case of success, otherwise an empty sequence.
+ /// Returns messages in case of success, otherwise an empty sequence.
///
public static IEnumerable SuccessMessages(this Result result)
{
@@ -661,4 +631,4 @@ public static Maybe ToMaybe(this Result)
- .MakeGenericType(type)
- .StaticMethod(
- "Some", value);
- }
-
- public static object None(Type type)
- {
- return typeof(FSharpOption<>)
- .MakeGenericType(type)
- .StaticProperty(
- "None");
- }
-
- public static object ValueOf(object value)
- {
- return typeof(FSharpOption<>)
- .MakeGenericType(GetUnderlyingType(value.GetType()))
- .InstanceProperty(
- "Value", value);
- }
-
- public static bool IsSome(object value)
- {
- return (bool)typeof(FSharpOption<>)
- .MakeGenericType(GetUnderlyingType(value.GetType()))
- .StaticMethod(
- "get_IsSome", value);
- }
- }
-}
\ No newline at end of file
diff --git a/src/CommandLine/Infrastructure/LocalizableAttributeProperty.cs b/src/CommandLine/Infrastructure/LocalizableAttributeProperty.cs
index b8bd1398..5ce7e808 100644
--- a/src/CommandLine/Infrastructure/LocalizableAttributeProperty.cs
+++ b/src/CommandLine/Infrastructure/LocalizableAttributeProperty.cs
@@ -3,21 +3,15 @@
namespace CommandLine.Infrastructure
{
- internal class LocalizableAttributeProperty
+ internal class LocalizableAttributeProperty(string propertyName)
{
- private string _propertyName;
private string _value;
private Type _type;
private PropertyInfo _localizationPropertyInfo;
- public LocalizableAttributeProperty(string propertyName)
- {
- _propertyName = propertyName;
- }
-
public string Value
{
- get { return GetLocalizedValue(); }
+ get => GetLocalizedValue();
set
{
_localizationPropertyInfo = null;
@@ -42,10 +36,10 @@ private string GetLocalizedValue()
{
// Static class IsAbstract
if (!_type.IsVisible)
- throw new ArgumentException($"Invalid resource type '{_type.FullName}'! {_type.Name} is not visible for the parser! Change resources 'Access Modifier' to 'Public'", _propertyName);
+ throw new ArgumentException($"Invalid resource type '{_type.FullName}'! {_type.Name} is not visible for the parser! Change resources 'Access Modifier' to 'Public'", propertyName);
PropertyInfo propertyInfo = _type.GetProperty(_value, BindingFlags.Public | BindingFlags.GetProperty | BindingFlags.Static);
if (propertyInfo == null || !propertyInfo.CanRead || (propertyInfo.PropertyType != typeof(string) && !propertyInfo.PropertyType.CanCast()))
- throw new ArgumentException($"Invalid resource property name! Localized value: {_value}", _propertyName);
+ throw new ArgumentException($"Invalid resource property name! Localized value: {_value}", propertyName);
_localizationPropertyInfo = propertyInfo;
}
diff --git a/src/CommandLine/Infrastructure/StringBuilderExtensions.cs b/src/CommandLine/Infrastructure/StringBuilderExtensions.cs
index ae4ccbc4..7d3aae2a 100644
--- a/src/CommandLine/Infrastructure/StringBuilderExtensions.cs
+++ b/src/CommandLine/Infrastructure/StringBuilderExtensions.cs
@@ -73,7 +73,7 @@ public static string SafeToString(this StringBuilder builder)
public static int SafeLength(this StringBuilder builder)
{
- return builder == null ? 0 : builder.Length;
+ return builder?.Length ?? 0;
}
public static StringBuilder TrimEnd(this StringBuilder builder, char c)
@@ -116,7 +116,7 @@ public static int TrailingSpaces(this StringBuilder builder)
///
/// Indicates whether the string value of a
- /// starts with the input parameter. Returns false if either
+ /// starts with the input parameter. Returns false if either
/// the StringBuilder or input string is null or empty.
///
/// The to test.
@@ -133,7 +133,7 @@ public static bool SafeStartsWith(this StringBuilder builder, string s)
///
/// Indicates whether the string value of a
- /// ends with the input parameter. Returns false if either
+ /// ends with the input parameter. Returns false if either
/// the StringBuilder or input string is null or empty.
///
/// The to test.
diff --git a/src/CommandLine/Infrastructure/StringExtensions.cs b/src/CommandLine/Infrastructure/StringExtensions.cs
index db8aa0bd..c575a86a 100644
--- a/src/CommandLine/Infrastructure/StringExtensions.cs
+++ b/src/CommandLine/Infrastructure/StringExtensions.cs
@@ -50,7 +50,7 @@ public static bool EqualsOrdinalIgnoreCase(this string strA, string strB)
public static int SafeLength(this string value)
{
- return value == null ? 0 : value.Length;
+ return value?.Length ?? 0;
}
public static string JoinTo(this string value, params string[] others)
diff --git a/src/CommandLine/IntrospectionExtensions.cs b/src/CommandLine/IntrospectionExtensions.cs
index 8e4c64ea..a33a0d56 100644
--- a/src/CommandLine/IntrospectionExtensions.cs
+++ b/src/CommandLine/IntrospectionExtensions.cs
@@ -7,7 +7,7 @@
namespace CommandLine
{
#if NET40
-
+
internal static class IntrospectionExtensions
{
public static Type GetTypeInfo(this Type type)
diff --git a/src/CommandLine/NameInfo.cs b/src/CommandLine/NameInfo.cs
index baf259ef..fa820f18 100644
--- a/src/CommandLine/NameInfo.cs
+++ b/src/CommandLine/NameInfo.cs
@@ -1,7 +1,6 @@
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
using System;
-using CommandLine.Core;
namespace CommandLine
{
@@ -15,48 +14,32 @@ public sealed class NameInfo : IEquatable
/// rather than options.
///
public static readonly NameInfo EmptyName = new NameInfo(string.Empty, string.Empty);
- private readonly string longName;
- private readonly string shortName;
internal NameInfo(string shortName, string longName)
{
- if (shortName == null) throw new ArgumentNullException("shortName");
- if (longName == null) throw new ArgumentNullException("longName");
-
- this.longName = longName;
- this.shortName = shortName;
+ this.LongName = longName ?? throw new ArgumentNullException(nameof(longName));
+ this.ShortName = shortName ?? throw new ArgumentNullException(nameof(shortName));
}
///
/// Gets the short name of the name information.
///
- public string ShortName
- {
- get { return shortName; }
- }
+ public string ShortName { get; }
///
/// Gets the long name of the name information.
///
- public string LongName
- {
- get { return longName; }
- }
+ public string LongName { get; }
///
/// Gets a formatted text with unified name information.
///
- public string NameText
- {
- get
- {
- return ShortName.Length > 0 && LongName.Length > 0
- ? ShortName + ", " + LongName
- : ShortName.Length > 0
- ? ShortName
- : LongName;
- }
- }
+ public string NameText =>
+ ShortName.Length > 0 && LongName.Length > 0
+ ? ShortName + ", " + LongName
+ : ShortName.Length > 0
+ ? ShortName
+ : LongName;
///
/// Determines whether the specified is equal to the current .
@@ -65,8 +48,7 @@ public string NameText
/// true if the specified is equal to the current ; otherwise, false.
public override bool Equals(object obj)
{
- var other = obj as NameInfo;
- if (other != null)
+ if (obj is NameInfo other)
{
return Equals(other);
}
@@ -98,4 +80,4 @@ public bool Equals(NameInfo other)
return ShortName.Equals(other.ShortName) && LongName.Equals(other.LongName);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/CommandLine/NullInstance.cs b/src/CommandLine/NullInstance.cs
index c2ebd77a..820a2f30 100644
--- a/src/CommandLine/NullInstance.cs
+++ b/src/CommandLine/NullInstance.cs
@@ -3,10 +3,10 @@
namespace CommandLine
{
///
- /// Models a null result when constructing a in a faling verbs scenario.
+ /// Models a null result when constructing a in a failing verbs scenario.
///
public sealed class NullInstance
{
internal NullInstance() { }
}
-}
\ No newline at end of file
+}
diff --git a/src/CommandLine/OptionAttribute.cs b/src/CommandLine/OptionAttribute.cs
index 6ae51dac..01a64f38 100644
--- a/src/CommandLine/OptionAttribute.cs
+++ b/src/CommandLine/OptionAttribute.cs
@@ -10,24 +10,16 @@ namespace CommandLine
/// Models an option specification.
///
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
- public sealed class OptionAttribute : BaseAttribute
+ public class OptionAttribute : BaseAttribute
{
- private readonly string longName;
- private readonly string shortName;
private string setName;
- private bool flagCounter;
- private char separator;
- private string group=string.Empty;
private OptionAttribute(string shortName, string longName) : base()
{
- if (shortName == null) throw new ArgumentNullException("shortName");
- if (longName == null) throw new ArgumentNullException("longName");
-
- this.shortName = shortName;
- this.longName = longName;
+ this.ShortName = shortName ?? throw new ArgumentNullException(nameof(shortName));
+ this.LongName = longName ?? throw new ArgumentNullException(nameof(longName));
setName = string.Empty;
- separator = '\0';
+ Separator = '\0';
}
///
@@ -61,7 +53,7 @@ public OptionAttribute(char shortName, string longName)
///
/// Initializes a new instance of the class.
///
- /// The short name of the option..
+ /// The short name of the option.
public OptionAttribute(char shortName)
: this(shortName.ToOneCharString(), string.Empty)
{
@@ -70,60 +62,37 @@ public OptionAttribute(char shortName)
///
/// Gets long name of this command line option. This name is usually a single english word.
///
- public string LongName
- {
- get { return longName; }
- }
+ public string LongName { get; }
///
/// Gets a short name of this command line option, made of one character.
///
- public string ShortName
- {
- get { return shortName; }
- }
+ public string ShortName { get; }
///
/// Gets or sets the option's mutually exclusive set name.
///
public string SetName
{
- get { return setName; }
- set
- {
- if (value == null) throw new ArgumentNullException("value");
-
- setName = value;
- }
+ get => setName;
+ set => setName = value ?? throw new ArgumentNullException(nameof(value));
}
///
/// If true, this is an int option that counts how many times a flag was set (e.g. "-v -v -v" or "-vvv" would return 3).
/// The property must be of type int (signed 32-bit integer).
///
- public bool FlagCounter
- {
- get { return flagCounter; }
- set { flagCounter = value; }
- }
+ public bool FlagCounter { get; set; }
///
/// When applying attribute to target properties,
/// it allows you to split an argument and consume its content as a sequence.
///
- public char Separator
- {
- get { return separator; }
- set { separator = value; }
- }
+ public char Separator { get; set; }
///
/// Gets or sets the option group name. When one or more options are grouped, at least one of them should have value. Required rules are ignored.
///
- public string Group
- {
- get { return group; }
- set { group = value; }
- }
+ public string Group { get; set; } = string.Empty;
}
}
diff --git a/src/CommandLine/Parser.cs b/src/CommandLine/Parser.cs
index 4301aa52..291a82dc 100644
--- a/src/CommandLine/Parser.cs
+++ b/src/CommandLine/Parser.cs
@@ -37,7 +37,7 @@ public Parser()
/// aspects and behaviors of the parser.
public Parser(Action configuration)
{
- if (configuration == null) throw new ArgumentNullException("configuration");
+ if (configuration == null) throw new ArgumentNullException(nameof(configuration));
settings = new ParserSettings();
configuration(settings);
@@ -61,18 +61,12 @@ internal Parser(ParserSettings settings)
///
/// Gets the singleton instance created with basic defaults.
///
- public static Parser Default
- {
- get { return DefaultParser.Value; }
- }
+ public static Parser Default => DefaultParser.Value;
///
/// Gets the instance that implements in use.
///
- public ParserSettings Settings
- {
- get { return settings; }
- }
+ public ParserSettings Settings => settings;
///
/// Parses a string array of command line arguments constructing values in an instance of type .
@@ -85,7 +79,7 @@ public ParserSettings Settings
/// Thrown if one or more arguments are null.
public ParserResult ParseArguments(IEnumerable args)
{
- if (args == null) throw new ArgumentNullException("args");
+ if (args == null) throw new ArgumentNullException(nameof(args));
var factory = typeof(T).IsMutable()
? Maybe.Just>(Activator.CreateInstance)
@@ -118,9 +112,9 @@ public ParserResult ParseArguments(IEnumerable args)
/// Thrown if one or more arguments are null.
public ParserResult ParseArguments(Func factory, IEnumerable args)
{
- if (factory == null) throw new ArgumentNullException("factory");
- if (!typeof(T).IsMutable()) throw new ArgumentException("factory");
- if (args == null) throw new ArgumentNullException("args");
+ if (factory == null) throw new ArgumentNullException(nameof(factory));
+ if (!typeof(T).IsMutable()) throw new ArgumentException(nameof(factory));
+ if (args == null) throw new ArgumentNullException(nameof(args));
return MakeParserResult(
InstanceBuilder.Build(
@@ -151,9 +145,9 @@ public ParserResult ParseArguments(Func factory, IEnumerable ar
/// All types must expose a parameterless constructor. It's strongly recommended to use a generic overload.
public ParserResult ParseArguments(IEnumerable args, params Type[] types)
{
- if (args == null) throw new ArgumentNullException("args");
- if (types == null) throw new ArgumentNullException("types");
- if (types.Length == 0) throw new ArgumentOutOfRangeException("types");
+ if (args == null) throw new ArgumentNullException(nameof(args));
+ if (types == null) throw new ArgumentNullException(nameof(types));
+ if (types.Length == 0) throw new ArgumentOutOfRangeException(nameof(types));
return MakeParserResult(
InstanceChooser.Choose(
diff --git a/src/CommandLine/ParserExtensions.cs b/src/CommandLine/ParserExtensions.cs
index 1c78ce9d..1e7d7fe2 100644
--- a/src/CommandLine/ParserExtensions.cs
+++ b/src/CommandLine/ParserExtensions.cs
@@ -25,7 +25,7 @@ public static class ParserExtensions
/// All types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2) });
}
@@ -46,7 +46,7 @@ public static ParserResult ParseArguments(this Parser parser, IE
/// All types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3) });
}
@@ -68,7 +68,7 @@ public static ParserResult ParseArguments(this Parser parser
/// All types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4) });
}
@@ -91,7 +91,7 @@ public static ParserResult ParseArguments(this Parser pa
/// All types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5) });
}
@@ -115,7 +115,7 @@ public static ParserResult ParseArguments(this Parse
/// All types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6) });
}
@@ -140,7 +140,7 @@ public static ParserResult ParseArguments(this P
/// All types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7) });
}
@@ -166,7 +166,7 @@ public static ParserResult ParseArguments(th
/// All types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8) });
}
@@ -193,7 +193,7 @@ public static ParserResult ParseArgumentsAll types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8),
typeof(T9) });
@@ -222,7 +222,7 @@ public static ParserResult ParseArgumentsAll types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8),
typeof(T9), typeof(T10) });
@@ -252,7 +252,7 @@ public static ParserResult ParseArgumentsAll types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8),
typeof(T9), typeof(T10), typeof(T11) });
@@ -283,7 +283,7 @@ public static ParserResult ParseArgumentsAll types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8),
typeof(T9), typeof(T10), typeof(T11), typeof(T12) });
@@ -315,7 +315,7 @@ public static ParserResult ParseArgumentsAll types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8),
typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13) });
@@ -348,7 +348,7 @@ public static ParserResult ParseArgumentsAll types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8),
typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14) });
@@ -382,7 +382,7 @@ public static ParserResult ParseArgumentsAll types must expose a parameterless constructor.
public static ParserResult ParseArguments(this Parser parser, IEnumerable args)
{
- if (parser == null) throw new ArgumentNullException("parser");
+ if (parser == null) throw new ArgumentNullException(nameof(parser));
return parser.ParseArguments(args, new[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5), typeof(T6), typeof(T7), typeof(T8),
typeof(T9), typeof(T10), typeof(T11), typeof(T12), typeof(T13), typeof(T14), typeof(T15) });
@@ -417,10 +417,10 @@ public static ParserResult ParseArgumentsAll types must expose a parameterless constructor.
public static ParserResult ParseArguments