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


C# Argument类代码示例

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


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


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