• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Argument类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Argument的典型用法代码示例。如果您正苦于以下问题:C# Argument类的具体用法?C# Argument怎么用?C# Argument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Argument类属于命名空间,在下文中一共展示了Argument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Format

        protected override IEnumerable<string> Format(Argument[] arguments)
        {
            var list = new List<string>();
            string deferred = null;
            foreach (var argument in arguments)
            {
                if (deferred != null)
                {
                    deferred += ",";
                }

                foreach (var line in this.Format(argument))
                {
                    if (deferred != null)
                    {
                        list.Add(deferred);
                    }

                    deferred = line;
                }
            }

            if (deferred != null)
            {
                list.Add(deferred);
            }

            return list;
        }
开发者ID:tmatz,项目名称:XamlStyler,代码行数:29,代码来源:MultiLineMarkupExtensionFormatter.cs


示例2: Invoke

		public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext)
		{
			if (input.Arguments.Count > 0)
			{
				var arguments = new Argument[input.Arguments.Count];

				for (int i = 0; i < input.Arguments.Count; i++)
				{
					arguments[i] = new Argument
					               	{
					              		Name = input.Arguments.ParameterName(i),
					              		Value = input.Arguments[i]
					              	};
				}

				_tape.RecordRequest(arguments, input.MethodBase.ReflectedType, input.MethodBase.Name);
			}

			Console.WriteLine("> Intercepting " + input.MethodBase.Name);
			Console.WriteLine("> Intercepting " + input.MethodBase.ReflectedType);

			IMethodReturn methodReturn = getNext()(input, getNext);

			Console.WriteLine("> Intercepted return value: " + methodReturn.ReturnValue.GetType().Name);

			if (methodReturn.ReturnValue != null)
			{
				_tape.RecordResponse(methodReturn.ReturnValue, input.MethodBase.ReflectedType, input.MethodBase.Name);
			}

			return methodReturn;
		}
开发者ID:yonglehou,项目名称:Betamax.Net,代码行数:32,代码来源:RecordingCallHandler.cs


示例3: GetResult

 private IEnumerable<string> GetResult(string text)
 {
     var mock = new Mock<IRunner>();
     mock.Setup(o => o.WorkingDirectory).Returns(Path.Combine(Environment.CurrentDirectory, "Test"));
     _argument = ArgumentFactory.Create(mock.Object, text);
     return _argument.Complete();
 }
开发者ID:neiz,项目名称:Wish,代码行数:7,代码来源:CmdArgumentTests.cs


示例4: concat

	private void concat(StringBuilder buf, Argument arg) {
		Iterator<Token>	it = arg.iterator();
		while (it.hasNext()) {
			Token	tok = it.next();
			buf.append(tok.getText());
		}
	}
开发者ID:tanis2000,项目名称:CppNet,代码行数:7,代码来源:MacroTokenSource.cs


示例5: IArgumentInfo_DefaultValue_returns_same_as_typed_property

        public void IArgumentInfo_DefaultValue_returns_same_as_typed_property()
        {
            var arg = new Argument<string>(_parser, "short", "long", "foo", false);
            arg.DefaultValue = "timmeh!";

            Assert.Equal("timmeh!", ((IArgument)arg).DefaultValue);
        }
开发者ID:nickdurcholz,项目名称:arguments-parser,代码行数:7,代码来源:CommandLineArgumentTests.cs


示例6: Command

 public Command(Argument[] arguments, string description, string group, string name)
 {
     Arguments = arguments;
     Description = description;
     Group = group;
     Name = name;
 }
开发者ID:Mavtak,项目名称:roomie,代码行数:7,代码来源:Command.cs


示例7: Make

 public static SCode Make(Primitive2 rator, Argument rand0, SCode rand1)
 {
     return
         (rand0 is Argument0) ? PrimitiveIsCharEqA0.Make (rator, (Argument0) rand0, rand1)
         : (rand0 is Argument1) ? PrimitiveIsCharEqA1.Make (rator, (Argument1) rand0, rand1)
         : Unimplemented ();
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:7,代码来源:PrimitiveIsCharEq.cs


示例8: GetValue

 public object GetValue(Argument arg, int size)
 {
     switch (Tag)
     {
     case TypeTag.Boolean:
     case TypeTag.Int8:
     case TypeTag.UInt8:
     case TypeTag.Int16:
     case TypeTag.UInt16:
     case TypeTag.Int32:
     case TypeTag.UInt32:
     case TypeTag.Int64:
     case TypeTag.UInt64:
     case TypeTag.Int:
     case TypeTag.UInt:
     case TypeTag.Long:
     case TypeTag.ULong:
     case TypeTag.SSize:
     case TypeTag.Size:
     case TypeTag.Float:
     case TypeTag.Double:
         return typeof(Argument).GetField(Tag.ToString()).GetValue(arg);
     case TypeTag.Utf8:
         return GObject.Marshaller.Utf8PtrToString((IntPtr) arg.Pointer);
     default:
         return null;
     }
 }
开发者ID:sciyoshi,项目名称:netgir,代码行数:28,代码来源:TypeInfo.cs


示例9: exception_is_thrown_when_argments_are_not_valid

        public void exception_is_thrown_when_argments_are_not_valid()
        {
            _parser.IsValid = false;

            var arg = new Argument<int>(_parser, "shortName", "longName", "description", true);
            int value;
            Assert.Throws<InvalidOperationException>(() => value = arg.Value);
        }
开发者ID:nickdurcholz,项目名称:arguments-parser,代码行数:8,代码来源:CommandLineArgumentTests.cs


示例10: Value_returns_default_value_when_IsMissing

 public void Value_returns_default_value_when_IsMissing()
 {
     _parser.IsValid = true;
     var arg = new Argument<string>(_parser, "short", "long", "foo", false);
     arg.IsMissing = true;
     arg.DefaultValue = "gobbles!";
     Assert.Equal("gobbles!", arg.Value);
 }
开发者ID:nickdurcholz,项目名称:arguments-parser,代码行数:8,代码来源:CommandLineArgumentTests.cs


示例11: ArgumentUsageInfo

 /// <summary>
 /// Constructor that forms the info from the argument's metadata.
 /// </summary>
 /// <param name="setAttribute">Argument set attribute.</param>
 /// <param name="arg">Argument metadata.</param>
 public ArgumentUsageInfo(ArgumentSetAttribute setAttribute, Argument arg)
 {
     Syntax = arg.GetSyntaxHelp(setAttribute);
     Description = arg.Attribute.HelpText;
     Required = arg.IsRequired;
     ShortName = arg.ShortName;
     DefaultValue = TryGetDefaultValueString(setAttribute, arg);
 }
开发者ID:reubeno,项目名称:NClap,代码行数:13,代码来源:ArgumentUsageInfo.cs


示例12: Action

 protected Action(Argument argument, IActionContainer container=null)
 {
     Argument = argument;
     Container = container;
     OptionStrings = new List<string>(Argument.OptionStrings ?? new string[] {});
     Destination = Argument.Destination;
     IsRequired = Argument.IsRequired;
 }
开发者ID:CrOrc,项目名称:Cr.ArgParse,代码行数:8,代码来源:Action.cs


示例13: Make

 public static SCode Make(Primitive2 rator, Argument rand0, SCode rand1)
 {
     return
         (rand0 is Argument0) ? PrimitiveIsObjectEqA0.Make (rator, (Argument0) rand0, rand1)
         : (rand0 is Argument1) ? PrimitiveIsObjectEqA1.Make (rator, (Argument1) rand0, rand1)
         : (rand1 is LexicalVariable) ? Unimplemented()
         : (rand1 is Quotation) ? PrimitiveIsObjectEqAQ.Make (rator, rand0, (Quotation) rand1)
         : new PrimitiveIsObjectEqA (rator, rand0, rand1);
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:9,代码来源:PrimitiveIsObjectEq.cs


示例14: Format

        protected IEnumerable<string> Format(Argument argument)
        {
            var type = argument.GetType();

            if (type == typeof(NamedArgument)) return Format((NamedArgument)argument);
            if (type == typeof(PositionalArgument)) return Format((PositionalArgument)argument);

            throw new ArgumentException("Unhandled type " + type.FullName, nameof(argument));
        }
开发者ID:NicoVermeir,项目名称:XamlStyler,代码行数:9,代码来源:MarkupExtensionFormatterBase.cs


示例15: SetArgumentValue

 internal void SetArgumentValue(IScriptExtent extent, object value)
 {
     if (this._argument == null)
     {
         this._argument = new Argument();
     }
     this._argument.value = value;
     this._argument.extent = extent;
 }
开发者ID:nickchal,项目名称:pash,代码行数:9,代码来源:CommandParameterInternal.cs


示例16: ExecutionStackItem

 public ExecutionStackItem(Argument arg)
 {
     _variable = new VariableItem();
     _variable.Value = arg.Value;
     if(arg.Value.Type == HVMType.Variable)
     {
         _variable.Name = arg.Value.StringValue;
     }
 }
开发者ID:bubbafat,项目名称:HVM,代码行数:9,代码来源:ExecutionStackItem.cs


示例17: Parser

        /// <summary>
        ///     Creates a new command line argument parser.
        /// </summary>
        /// <param name="argumentSpecification"> The type of object to parse. </param>
        /// <param name="reporter"> The destination for parse errors. </param>
        private Parser(Type argumentSpecification, ErrorReporter reporter)
        {
            this.reporter = reporter;
            this.reporter += Log.Error;
            this.arguments = new ArrayList();
            this.argumentMap = new Hashtable();

            foreach (FieldInfo field in argumentSpecification.GetFields())
            {
                if (!field.IsStatic && !field.IsInitOnly && !field.IsLiteral)
                {
                    ArgumentAttribute attribute = GetAttribute(field);
                    if (attribute is DefaultArgumentAttribute)
                    {
                        Debug.Assert(this.defaultArgument == null);
                        this.defaultArgument = new Argument(attribute, field, reporter);
                    }
                    else
                    {
                        this.arguments.Add(new Argument(attribute, field, reporter));
                    }
                }
            }

            // add explicit names to map
            foreach (Argument argument in this.arguments)
            {
                Debug.Assert(!this.argumentMap.ContainsKey(argument.LongName));
                this.argumentMap[argument.LongName] = argument;
                if (argument.ExplicitShortName)
                {
                    if (!string.IsNullOrEmpty(argument.ShortName))
                    {
                        Debug.Assert(!this.argumentMap.ContainsKey(argument.ShortName));
                        this.argumentMap[argument.ShortName] = argument;
                    }
                    else
                    {
                        argument.ClearShortName();
                    }
                }
            }

            // add implicit names which don't collide to map
            foreach (Argument argument in this.arguments)
            {
                if (!argument.ExplicitShortName)
                {
                    if (!string.IsNullOrEmpty(argument.ShortName) &&
                        !this.argumentMap.ContainsKey(argument.ShortName))
                        this.argumentMap[argument.ShortName] = argument;
                    else
                        argument.ClearShortName();
                }
            }
        }
开发者ID:RSchwoerer,项目名称:Terminals,代码行数:61,代码来源:Parser.cs


示例18: Process

  static void Process(Argument cmdline){
    if(cmdline.IsTest){
      Trans.Test(cmdline);
      return;
    }

    // 各ファイルに対する処理
    System.Text.StringBuilder bcontent=new System.Text.StringBuilder();
    foreach(string file in cmdline.FileNames){
      string content1=System.IO.File.ReadAllText(file,System.Text.Encoding.UTF8);
      if(cmdline.Verbose)
        cmdline.WriteLine("gzjs: read from {0}.",file);

      content1=Trans.ProcessSource(content1,cmdline);
      if(cmdline.TokenReplacing)
        content1=Trans.GenerateTokenReplacing2(content1,cmdline);
      bcontent.Append(content1);
    }

    // 全体に対する処理
    string content=bcontent.ToString();
    if(cmdline.IsSfx85)
      content=Trans.CreateSfx85(content);
    else if(cmdline.IsSfx)
      content=Trans.CreateSfx(content);

    content=content.Replace("\r\n","\n");

    // 書込
    if(cmdline.IsGzipCompress){
      string gzfile=cmdline.OutputFile;
      if(cmdline.OutputFile=="-"){
        using(System.IO.Stream stdout=System.Console.OpenStandardOutput())
          IO.SaveAsGzipFile(stdout,content);
      }else
        IO.SaveAsGzipFile(gzfile,content);

      // <gzip.exe を使う場合>
      // string tempfile=System.IO.Path.Combine(IO.path_temp,System.IO.Path.GetFileName(cmdline.OutputFile));
      // writeFile(tempfile,content);
      // string gzfile=cmdline.OutputFile+".gz";
      // IO.gzip(tempfile,gzfile,false);
      // </gzip>

      if(cmdline.Verbose)
        cmdline.WriteLine("gzjs: wrote to {0}.",gzfile);
    }else{
      string outfile=cmdline.OutputFile;
      if(outfile=="-")
        System.Console.Write(content);
      else
        writeFile(outfile,content);
      if(cmdline.Verbose)
        cmdline.WriteLine("gzjs: wrote to {0}.",outfile);
    }
  }
开发者ID:akinomyoga,项目名称:agh,代码行数:56,代码来源:gzjs.cs


示例19: evaluateArgument

 private object evaluateArgument(Argument argument) {
     if (argument.style == Argument.Style.Constant) {
         return argument.value;
     } else if (argument.style == Argument.Style.Parameter) {
         return ((Parameter)argument.value).value;
     } else if (argument.style == Argument.Style.Filter) {
         return evaluateFilter((Method)argument.value);
     }
     return null;
 }
开发者ID:GregWeil,项目名称:ResearchProjectGSAS,代码行数:10,代码来源:StateMachine.cs


示例20: Parser

 public Parser(Type argumentSpecification, ErrorReporter reporter)
 {
     this.reporter = reporter;
     arguments = new ArrayList();
     argumentMap = new Hashtable();
     FieldInfo[] fields = argumentSpecification.GetFields();
     for (int i = 0; i < fields.Length; i++)
     {
         FieldInfo field = fields[i];
         if (!field.IsStatic && !field.IsInitOnly && !field.IsLiteral)
         {
             ArgumentAttribute attribute = GetAttribute(field);
             if (attribute is DefaultArgumentAttribute)
             {
                 Debug.Assert(defaultArgument == null);
                 defaultArgument = new Argument(attribute, field, reporter);
             }
             else
             {
                 arguments.Add(new Argument(attribute, field, reporter));
             }
         }
     }
     foreach (Argument argument in arguments)
     {
         Debug.Assert(!argumentMap.ContainsKey(argument.LongName));
         argumentMap[argument.LongName] = argument;
         if (argument.ExplicitShortName)
         {
             if (argument.ShortName != null && argument.ShortName.Length > 0)
             {
                 Debug.Assert(!argumentMap.ContainsKey(argument.ShortName));
                 argumentMap[argument.ShortName] = argument;
             }
             else
             {
                 argument.ClearShortName();
             }
         }
     }
     foreach (Argument argument in arguments)
     {
         if (!argument.ExplicitShortName)
         {
             if (argument.ShortName != null && argument.ShortName.Length > 0 && !argumentMap.ContainsKey(argument.ShortName))
             {
                 argumentMap[argument.ShortName] = argument;
             }
             else
             {
                 argument.ClearShortName();
             }
         }
     }
 }
开发者ID:bittercoder,项目名称:HeatSite,代码行数:55,代码来源:Parser.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Argument0类代码示例发布时间:2022-05-24
下一篇:
C# Args类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap