.NET Fiddle

CSharp · Console

/Program.cs

//https://github.com/commandlineparser/commandline/issues/422
// @nuget: CommandLineParser -Version 2.3.0

using System;
using CommandLine;
using System.Collections.Generic;

public class myClass {
	public static void Main()
	{
		var p = new Parser(conf => {
			conf.EnableDashDash = true;
		});
		var parserResult = p.ParseArguments<Options>("-n hi hiho -- --name 10 20 30".Split());

		parserResult.WithParsed<Options>(options => options.Dump());
		parserResult.WithNotParsed<Options>(errs => errs.Dump());
	}
}

class Options
{
	[Option('n', "name")]
	public string Name { get; set; }
	
	[CommandLine.Value(0)]
	public string Expected {get;set;}
	
	[CommandLine.Value(1)]
	public IEnumerable<string> Unexpected { get; set; }
}
;