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


C# IParameterDefinition类代码示例

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


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

示例1: PrintParameterDefinitionModifiers

    public virtual void PrintParameterDefinitionModifiers(IParameterDefinition parameterDefinition) {
      Contract.Requires(parameterDefinition != null);

      if (parameterDefinition.Index == 0) {
        var meth = parameterDefinition.ContainingSignature as IMethodDefinition;
        if (meth != null ) {
          if (Utils.FindAttribute(meth.Attributes, SpecialAttribute.Extension) != null) {
            PrintToken(CSharpToken.This);
            PrintToken(CSharpToken.Space);
          }
        }
      }

      foreach (var attribute in SortAttributes(parameterDefinition.Attributes)) {
        if (Utils.GetAttributeType(attribute) == SpecialAttribute.ParamArray)
          sourceEmitterOutput.Write("params");
        else
          this.PrintAttribute(parameterDefinition, attribute, false, null);

        PrintToken(CSharpToken.Space);
      }
      if (parameterDefinition.IsOut && !parameterDefinition.IsIn && parameterDefinition.IsByReference) {
        // C# out keyword means [Out] ref (with no [In] allowed)
        PrintKeywordOut();
      } else {
        if (parameterDefinition.IsIn)
          PrintPseudoCustomAttribute(parameterDefinition, "System.Runtime.InteropServices.In", null, false, null);
        if (parameterDefinition.IsOut)
          PrintPseudoCustomAttribute(parameterDefinition, "System.Runtime.InteropServices.Out", null, false, null);
        if (parameterDefinition.IsByReference)
          PrintKeywordRef();
      }
    }
开发者ID:xornand,项目名称:cci,代码行数:33,代码来源:ParameterSourceEmitter.cs

示例2: TraverseChildren

 public override void TraverseChildren(IParameterDefinition parameterDefinition) {
   PrintParameterDefinitionModifiers(parameterDefinition);
   PrintParameterDefinitionName(parameterDefinition);
   PrintToken(VBToken.Space);
   PrintToken(VBToken.As);
   PrintToken(VBToken.Space);
   PrintParameterDefinitionType(parameterDefinition);
 }
开发者ID:xornand,项目名称:cci,代码行数:8,代码来源:ParameterSourceEmitter.cs

示例3: GetModifier

        private string GetModifier(IParameterDefinition parameter)
        {
            if (parameter.IsOut && !parameter.IsIn && parameter.IsByReference)
                return "out";
            else if (parameter.IsByReference)
                return "ref";

            return "in";
        }
开发者ID:dsgouda,项目名称:buildtools,代码行数:9,代码来源:ParameterModifiersCannotChange.cs

示例4: ParameterDefinition

 public ParameterDefinition(IParameterDefinition copyFrom) : base(copyFrom)
 {
     Context = copyFrom.Context;
     DataType = copyFrom.DataType;
     IsRequired = copyFrom.IsRequired;
     IsVariadic = copyFrom.IsVariadic;
     Name = copyFrom.Name;
     Type = copyFrom.Type;
 }
开发者ID:skrymsli,项目名称:Swasey,代码行数:9,代码来源:ParameterDefinition.cs

示例5: CciParameterDetails

        public CciParameterDetails(IParameterDefinition parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException("parameter");
            }

            _parameter = parameter;
        }
开发者ID:Pablissimo,项目名称:nrconfig,代码行数:9,代码来源:CciParameterDetails.cs

示例6: MethodParameter

    public MethodParameter(IParameterDefinition parameterDefinition, Bpl.Type ptype) {
      this.underlyingParameter = parameterDefinition;

      var parameterToken = parameterDefinition.Token();
      var typeToken = parameterDefinition.Type.Token();
      var parameterName = TranslationHelper.TurnStringIntoValidIdentifier(parameterDefinition.Name.Value);
      if (String.IsNullOrWhiteSpace(parameterName)) parameterName = "P" + parameterDefinition.Index.ToString();

      this.inParameterCopy = new Bpl.Formal(parameterToken, new Bpl.TypedIdent(typeToken, parameterName + "$in", ptype), true);
      if (parameterDefinition.IsByReference) {
        this.outParameterCopy = new Bpl.Formal(parameterToken, new Bpl.TypedIdent(typeToken, parameterName + "$out", ptype), false);
      } else {
        this.outParameterCopy = new Bpl.LocalVariable(parameterToken, new Bpl.TypedIdent(typeToken, parameterName, ptype));
      }
    }
开发者ID:lleraromero,项目名称:bytecodetranslator,代码行数:15,代码来源:TranslationHelper.cs

示例7: MethodParameter

    public MethodParameter(IParameterDefinition parameterDefinition) {

      this.underlyingParameter = parameterDefinition;

      Bpl.Type ptype = Bpl.Type.Int;

      var parameterToken = parameterDefinition.Token();
      var typeToken = parameterDefinition.Type.Token();
      var parameterName = parameterDefinition.Name.Value;

      if (!parameterDefinition.IsOut) {
        this.inParameterCopy = new Bpl.Formal(parameterToken, new Bpl.TypedIdent(typeToken, parameterName + "$in", ptype), true);
      }
      if (parameterDefinition.IsByReference || parameterDefinition.IsOut) {
        this.outParameterCopy = new Bpl.Formal(parameterToken, new Bpl.TypedIdent(typeToken, parameterName + "$out", ptype), false);
      } else {
        this.outParameterCopy = new Bpl.LocalVariable(parameterToken, new Bpl.TypedIdent(typeToken, parameterName, ptype));
      }
      
    }
开发者ID:hesam,项目名称:SketchSharp,代码行数:20,代码来源:TranslationHelper.cs

示例8: Visit

 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Performs some computation with the given parameter definition.
 /// </summary>
 /// <param name="parameterDefinition"></param>
 public virtual void Visit(IParameterDefinition parameterDefinition)
 {
     if (this.stopTraversal) return;
       //^ int oldCount = this.path.Count;
       this.path.Push(parameterDefinition);
       this.Visit(parameterDefinition.Attributes);
       if (parameterDefinition.IsModified)
     this.Visit(parameterDefinition.CustomModifiers);
       if (parameterDefinition.HasDefaultValue)
     this.Visit((IMetadataExpression)parameterDefinition.DefaultValue);
       if (parameterDefinition.IsMarshalledExplicitly)
     this.Visit(parameterDefinition.MarshallingInformation);
       this.Visit(parameterDefinition.Type);
       //^ assume this.path.Count == oldCount+1; //True because all of the virtual methods of this class promise not decrease this.path.Count.
       this.path.Pop();
 }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:21,代码来源:Visitors.cs

示例9: AddOriginalParameter

 public void AddOriginalParameter(IParameterDefinition parameter)
 {
     var parameterInfo = new ReplacementParameterInfo();
     parameterInfo.Name = parameter.Name.Value;
     parameterInfo.IsOut = parameter.IsOut;
     parameterInfo.IsRef = parameter.IsByReference;
     parameterInfo.Type = parameter.Type;
     parameterInfo.Definition = parameter;
 }
开发者ID:jamarchist,项目名称:SharpMock,代码行数:9,代码来源:AddInterceptionTargetsToAssembly.cs

示例10: GetModuleParameters

 protected IParameterDefinition[] GetModuleParameters(bool useParamInfo, ISignature signatureDefinition, int paramCount) {
   MethodDefinition/*?*/ moduleMethod = signatureDefinition as MethodDefinition;
   int paramIndex = 0;
   var parameters = new IParameterDefinition[paramCount];
   while (paramIndex < paramCount) {
     bool dummyPinned;
     var customModifiers = this.GetCustomModifiers(out dummyPinned);
     byte currByte = this.SignatureMemoryReader.PeekByte(0);
     if (currByte == ElementType.Sentinel) {
       this.SignatureMemoryReader.SkipBytes(1);
       var requiredParameters = new IParameterDefinition[paramIndex];
       for (int i = 0; i < paramIndex; i++) requiredParameters[i] = parameters[i];
       return requiredParameters;
     }
     bool isByReference = false;
     ITypeReference/*?*/ typeReference;
     if (currByte == ElementType.TypedReference) {
       this.SignatureMemoryReader.SkipBytes(1);
       typeReference = this.PEFileToObjectModel.PlatformType.SystemTypedReference;
     } else {
       if (currByte == ElementType.ByReference) {
         this.SignatureMemoryReader.SkipBytes(1);
         isByReference = true;
       }
       typeReference = this.GetTypeReference();
     }
     ParamInfo? paramInfo = useParamInfo ? this.GetParamInfo(paramIndex + 1) : null;
     IParameterDefinition moduleParameter;
     if (paramInfo.HasValue) {
       var paramArrayType = typeReference as IArrayTypeReference;
       moduleParameter = new ParameterWithMetadata(this.PEFileToObjectModel, paramIndex, customModifiers, typeReference, moduleMethod, isByReference,
         (paramIndex == paramCount - 1) && paramArrayType != null && paramArrayType.IsVector, paramInfo.Value.ParamRowId, paramInfo.Value.ParamName, paramInfo.Value.ParamFlags);
     } else
       moduleParameter = new ParameterWithoutMetadata(this.PEFileToObjectModel, paramIndex, customModifiers, typeReference, signatureDefinition, isByReference);
     parameters[paramIndex++] = moduleParameter;
   }
   return parameters;
 }
开发者ID:Biegal,项目名称:Afterthought,代码行数:38,代码来源:PEFileToObjectModel.cs

示例11: Visit

        public virtual void Visit(IParameterDefinition parameterDefinition)
        {
            var marshalling = parameterDefinition.MarshallingInformation;

            Debug.Assert((marshalling != null || !parameterDefinition.MarshallingDescriptor.IsDefaultOrEmpty) == parameterDefinition.IsMarshalledExplicitly);

            this.Visit(parameterDefinition.GetAttributes(Context));
            this.Visit(parameterDefinition.CustomModifiers);

            IMetadataConstant defaultValue = parameterDefinition.GetDefaultValue(Context);
            if (defaultValue != null)
            {
                this.Visit((IMetadataExpression)defaultValue);
            }

            if (marshalling != null)
            {
                // Note, we are not visiting MarshallingDescriptor. It is used only for 
                // NoPia embedded/local types and VB Dev11 simply copies the bits without
                // cracking them.
                this.Visit(marshalling);
            }

            this.Visit(parameterDefinition.GetType(Context));
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:25,代码来源:MetadataVisitor.cs

示例12: WriteParameter

        private void WriteParameter(IParameterDefinition parameter, bool extensionMethod)
        {
            WriteAttributes(parameter.Attributes, true);

            if (extensionMethod)
                WriteKeyword("this");

            if (parameter.IsParameterArray)
                WriteKeyword("params");

            if (parameter.IsOut && !parameter.IsIn && parameter.IsByReference)
            {
                WriteKeyword("out");
            }
            else
            {
                // For In/Out we should not emit them until we find a scenario that is needs thems.
                //if (parameter.IsIn)
                //   WriteFakeAttribute("System.Runtime.InteropServices.In", writeInline: true);
                //if (parameter.IsOut)
                //    WriteFakeAttribute("System.Runtime.InteropServices.Out", writeInline: true);
                if (parameter.IsByReference)
                    WriteKeyword("ref");
            }

            WriteTypeName(parameter.Type, isDynamic: IsDynamic(parameter.Attributes));
            WriteIdentifier(parameter.Name);
            if (parameter.IsOptional && parameter.HasDefaultValue)
            {
                WriteSymbol("=");
                WriteMetadataConstant(parameter.DefaultValue, parameter.Type);
            }
        }
开发者ID:pgavlin,项目名称:ApiTools,代码行数:33,代码来源:CSDeclarationWriter.Methods.cs

示例13: VisitReference

 public void VisitReference(IParameterDefinition parameterDefinition)
 {
     throw new NotImplementedException();
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:4,代码来源:Visitors.cs

示例14: VisitReference

 /// <summary>
 /// Performs some computation with the given parameter definition.
 /// </summary>
 public void VisitReference(IParameterDefinition parameterDefinition)
 {
 }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:6,代码来源:Validator.cs

示例15: Traverse

 /// <summary>
 /// Traverses the parameter definition.
 /// </summary>
 public void Traverse(IParameterDefinition parameterDefinition)
 {
     Contract.Requires(parameterDefinition != null);
       if (!this.objectsThatHaveAlreadyBeenTraversed.Add(parameterDefinition)) return;
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(parameterDefinition);
       if (this.stopTraversal) return;
       this.TraverseChildren(parameterDefinition);
       if (this.stopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(parameterDefinition);
 }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:13,代码来源:Visitors.cs


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