当前位置: 首页>>代码示例>>C#>>正文


C# Args.Get方法代码示例

本文整理汇总了C#中Args.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Args.Get方法的具体用法?C# Args.Get怎么用?C# Args.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Args的用法示例。


在下文中一共展示了Args.Get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestUsge

 public void TestUsge()
 {
     var args = new Args(1, "abc", new DateTime(2013, 10, 15), this);
       Assert.That(args.Get<int>(0), Is.EqualTo(1));
       Assert.That(args.Get<string>(1), Is.EqualTo("abc"));
       Assert.That(args.Get<DateTime>(2), Is.EqualTo(new DateTime(2013, 10, 15)));
       Assert.That(args.Get<ArgsTest>(3), Is.SameAs(this));
 }
开发者ID:asipe,项目名称:SupaCharge,代码行数:8,代码来源:ArgsTest.cs

示例2: ExtraArgumentsThatLookLikeFlags

 public void ExtraArgumentsThatLookLikeFlags()
 {
     var args = new Args("x,y", "-x", "alpha", "-y", "beta");
     args.Has('x').ShouldBeTrue();
     args.Has('y').ShouldBeFalse();
     args.Get<bool>('x').ShouldBeTrue();
     args.Get<bool>('y').ShouldBeFalse();
     args.NextArgument().ShouldBe(1);
 }
开发者ID:mmozuras,项目名称:NArgs,代码行数:9,代码来源:ArgsTests.cs

示例3: ExtraArguments

 public void ExtraArguments()
 {
     var args = new Args("x,y*", "-x", "-y", "alpha", "beta");
     args.Has('x').ShouldBeTrue();
     args.Has('y').ShouldBeTrue();
     args.Get<bool>('x').ShouldBeTrue();
     args.Get<string>('y').ShouldBe("alpha");
     args.NextArgument().ShouldBe(3);
 }
开发者ID:mmozuras,项目名称:NArgs,代码行数:9,代码来源:ArgsTests.cs

示例4: SimpleIntPresent

 public void SimpleIntPresent()
 {
     var args = new Args("x#", "-x", "42");
     args.Has('x').ShouldBeTrue();
     args.Get<int>('x').ShouldBe(42);
     args.NextArgument().ShouldBe(2);
 }
开发者ID:mmozuras,项目名称:NArgs,代码行数:7,代码来源:ArgsTests.cs

示例5: Main

        private static void Main(string[] _args)
        {
            Console.Out.WriteLine("Utility to remove all perforce pending change lists without files from current workspace.");
              Console.Out.WriteLine("(C) 2011 Eugene Petrenko.");

              Console.Out.WriteLine("Usage: ");
              Console.Out.WriteLine(" p4ccc.exe [-client]");
              Console.Out.WriteLine("         -client        specifies workspace to perform the clean ");
              Console.Out.WriteLine("                        %P4CLIENT% in considered by default");
              Console.Out.WriteLine("");

              if (Environment.CommandLine.Contains("/?") || Environment.CommandLine.Contains("-?") ||
              Environment.CommandLine.Contains("-help"))
            return;

              var args = new Args(_args);

              string client = args.Get("client", Environment.GetEnvironmentVariable("P4CLIENT"));
              Console.Out.WriteLine("p4 client = {0}", client);

              var rx = new Regex("^Change\\s(\\d+)");
              try
              {
            var lists = RunCommand("p4", "changelists -s pending -c MUNIT-009")
              .Select(x =>
                    {
                      Match match = rx.Match(x);
                      if (!match.Success)
                        return (int?) null;

                      try
                      {
                        return
                          int.Parse(
                            match.Groups[1].Value);
                      }
                      catch
                      {
                        return null;
                      }
                    })
              .Where(x => x != null)
              .Select(x => x.Value)
              .ToArray();

            foreach (var list in lists)
            {
              try
              {
            RunCommand("p4", "changelist -d " + list);
              }
              catch
              {
            Console.Out.WriteLine("Failed to delete changelist {0}", list);
              }
            }
              }
              catch (Exception e)
              {
            Console.Out.WriteLine("Failed. " + e.Message);
              }
        }
开发者ID:jonnyzzz,项目名称:utils,代码行数:62,代码来源:Program.cs

示例6: SimpleStringPresent

 public void SimpleStringPresent()
 {
     var args = new Args("x*", "-x", "param");
     args.Has('x').ShouldBeTrue();
     args.Get<string>('x').ShouldBe("param");
     args.NextArgument().ShouldBe(2);
 }
开发者ID:mmozuras,项目名称:NArgs,代码行数:7,代码来源:ArgsTests.cs

示例7: SimpleDoublePresent

 public void SimpleDoublePresent()
 {
     var args = new Args("x##", "-x", "42.3");
     args.Has('x').ShouldBeTrue();
     args.Get<double>('x').ShouldBe(42.3);
 }
开发者ID:mmozuras,项目名称:NArgs,代码行数:6,代码来源:ArgsTests.cs

示例8: SimpleBooleanPresent

 public void SimpleBooleanPresent()
 {
     var args = new Args("x", "-x");
     args.Get<bool>('x').ShouldBeTrue();
     args.NextArgument().ShouldBe(1);
 }
开发者ID:mmozuras,项目名称:NArgs,代码行数:6,代码来源:ArgsTests.cs

示例9: StringArray

 public void StringArray()
 {
     var args = new Args("x[*]", "-x", "alpha");
     args.Has('x').ShouldBeTrue();
     var result = args.Get<List<string>>('x');
     result.Count.ShouldBe(1);
     result[0].ShouldBe("alpha");
 }
开发者ID:mmozuras,项目名称:NArgs,代码行数:8,代码来源:ArgsTests.cs


注:本文中的Args.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。