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


C# IMethod.GetParameters方法代码示例

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


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

示例1: WriteCallInvokeMethod

        /// <summary>
        /// </summary>
        /// <param name="llvmWriter">
        /// </param>
        /// <param name="objectResult">
        /// </param>
        /// <param name="methodResult">
        /// </param>
        /// <param name="invokeMethod">
        /// </param>
        /// <param name="isStatic">
        /// </param>
        /// <returns>
        /// </returns>
        public static FullyDefinedReference WriteCallInvokeMethod(
            this LlvmWriter llvmWriter, FullyDefinedReference objectResult, FullyDefinedReference methodResult, IMethod invokeMethod, bool isStatic)
        {
            var writer = llvmWriter.Output;

            var method = new SynthesizedInvokeMethod(llvmWriter, objectResult, methodResult, invokeMethod, isStatic);
            var opCodeNope = OpCodePart.CreateNop;

            opCodeNope.OpCodeOperands =
                Enumerable.Range(0, invokeMethod.GetParameters().Count()).Select(p => new OpCodeInt32Part(OpCodesEmit.Ldarg, 0, 0, p + 1)).ToArray();

            foreach (var generatedOperand in opCodeNope.OpCodeOperands)
            {
                llvmWriter.ActualWrite(writer, generatedOperand);
            }

            writer.WriteLine(string.Empty);

            // bitcast object to method
            var opCodeNopeForBitCast = OpCodePart.CreateNop;
            opCodeNopeForBitCast.OpCodeOperands = new[] { OpCodePart.CreateNop };
            opCodeNopeForBitCast.OpCodeOperands[0].Result = methodResult;
            llvmWriter.UnaryOper(writer, opCodeNopeForBitCast, "bitcast", methodResult.Type, options: LlvmWriter.OperandOptions.GenerateResult);
            writer.Write(" to ");
            llvmWriter.WriteMethodPointerType(writer, method);
            writer.WriteLine(string.Empty);

            method.MethodResult = opCodeNopeForBitCast.Result;

            // actual call
            llvmWriter.WriteCall(opCodeNope, method, false, !isStatic, false, objectResult, llvmWriter.tryScopes.Count > 0 ? llvmWriter.tryScopes.Peek() : null);
            writer.WriteLine(string.Empty);

            return opCodeNope.Result;
        }
开发者ID:SperoSophia,项目名称:il2bc,代码行数:49,代码来源:DelegateGen.cs

示例2: CallableSignature

 public CallableSignature(IMethod method)
 {
     if (null == method)
     {
         throw new ArgumentNullException("method");
     }
     Initialize(method.GetParameters(), method.ReturnType, method.AcceptVarArgs);
 }
开发者ID:boo,项目名称:boo-lang,代码行数:8,代码来源:CallableSignature.cs

示例3: ToTreeNode

        private IBooParseTreeNode ToTreeNode(IMethod method)
        {
            var member = new MethodTreeNode(new EntitySourceOrigin(method), method.ReturnType.ToString(), method.DeclaringType.FullName);

            foreach (var parameter in method.GetParameters())
            {
                member.Parameters.Add(new MethodParameter
                {
                    Name = parameter.Name,
                    Type = parameter.Type.ToString()
                });
            }

            return member;
        }
开发者ID:jagregory,项目名称:boolangstudio,代码行数:15,代码来源:EntityToTreeNodeConverter.cs

示例4: IsMatchingGenericParamsAndReturnType

        /// <summary>
        /// </summary>
        /// <param name="method">
        /// </param>
        /// <param name="genericMethod">
        /// </param>
        /// <returns>
        /// </returns>
        private static bool IsMatchingGenericParamsAndReturnType(this IMethod method, IMethod genericMethod)
        {
            var params1 = method.GetParameters().ToArray();
            var genParams2 = genericMethod.GetParameters().ToArray();

            if (params1.Length != genParams2.Length)
            {
                return false;
            }

            for (var i = 0; i < params1.Length; i++)
            {
                if (params1[i].Name != genParams2[i].Name)
                {
                    return false;
                }
            }

            for (var i = 0; i < params1.Length; i++)
            {
                if (params1[i].IsOut != genParams2[i].IsOut || params1[i].IsRef != genParams2[i].IsRef
                    || !CompareTypeWithGenericType(params1[i].ParameterType, genParams2[i].ParameterType))
                {
                    return false;
                }
            }

            if (CompareTypeWithGenericType(method.ReturnType, genericMethod.ReturnType, true))
            {
                return true;
            }

            return false;
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:42,代码来源:OpCodeExtentions.cs

示例5: ShouldExpandArgs

 public override bool ShouldExpandArgs(IMethod method, ExpressionCollection args)
 {
     return (!UnityCallableResolutionServiceModule.IsArrayArgumentExplicitlyProvided(method.GetParameters(), args) ? base.ShouldExpandArgs(method, args) : false);
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:4,代码来源:UnityCallableResolutionService.cs

示例6: GetExtendedMacroType

 IType GetExtendedMacroType(IMethod method)
 {
     InternalMethod internalMethod = method as InternalMethod;
     if (null != internalMethod)
     {
         Method extension = internalMethod.Method;
         if (!extension.Attributes.Contains(Types.BooExtensionAttribute.FullName)
             || !extension.Attributes.Contains(Types.CompilerGeneratedAttribute.FullName))
             return null;
         SimpleTypeReference sref = extension.Parameters[0].Type as SimpleTypeReference;
         if (null != sref && extension.Parameters.Count == 2)
         {
             IType type = NameResolutionService.ResolveQualifiedName(sref.Name) as IType;
             if (type != null && type.Name.EndsWith("Macro")) //no entity yet
                 return type;
         }
     }
     else if (method is ExternalMethod && method.IsExtension)
     {
         var parameters = method.GetParameters();
         if (parameters.Length == 2 && TypeSystemServices.IsMacro(parameters[0].Type))
             return parameters[0].Type;
     }
     return null;
 }
开发者ID:scottstephens,项目名称:boo,代码行数:25,代码来源:MacroExpander.cs

示例7: CreateMethodFromPrototype

        public Method CreateMethodFromPrototype(LexicalInfo lexicalInfo, IMethod baseMethod, TypeMemberModifiers newModifiers)
        {
            Method method = new Method(lexicalInfo);
            method.Name = baseMethod.Name;
            method.Modifiers = newModifiers;
            method.IsSynthetic = true;

            if (null != baseMethod.GenericInfo)
                DeclareGenericParameters(method, baseMethod.GenericInfo.GenericParameters);

            DeclareParameters(method, baseMethod.GetParameters());

            method.ReturnType = CreateTypeReference(baseMethod.ReturnType);
            method.Entity = (null != baseMethod.GenericInfo)
                            ? new InternalGenericMethod(_tss, method)
                            : new InternalMethod(_tss, method);

            return method;
        }
开发者ID:w4x,项目名称:boolangstudio,代码行数:19,代码来源:BooCodeBuilder.cs

示例8: CheckParameterTypesStrictly

 bool CheckParameterTypesStrictly(IMethod method, ExpressionCollection args)
 {
     IParameter[] parameters = method.GetParameters();
     for (int i=0; i<args.Count; ++i)
     {
         IType expressionType = GetExpressionType(args[i]);
         IType parameterType = parameters[i].Type;
         if (!IsAssignableFrom(parameterType, expressionType) &&
             !(TypeSystemServices.IsNumber(expressionType) && TypeSystemServices.IsNumber(parameterType))
             && TypeSystemServices.FindImplicitConversionOperator(expressionType,parameterType) == null)
         {
             return false;
         }
     }
     return true;
 }
开发者ID:stuman08,项目名称:boo,代码行数:16,代码来源:ProcessMethodBodies.cs

示例9: CheckOverrideSignature

		public static bool CheckOverrideSignature(IMethod impl, IMethod baseMethod)
		{
			if (!GenericsServices.AreOfSameGenerity(impl, baseMethod))
				return false;

			CallableSignature baseSignature = GetOverriddenSignature(baseMethod, impl);
			return CheckOverrideSignature(impl.GetParameters(), baseSignature.Parameters);
		}
开发者ID:HaKDMoDz,项目名称:GNet,代码行数:8,代码来源:TypeSystemServices.cs

示例10: IsMatchingParamsAndReturnType

        /// <summary>
        /// </summary>
        /// <param name="method">
        /// </param>
        /// <param name="overridingMethod">
        /// </param>
        /// <returns>
        /// </returns>
        private static bool IsMatchingParamsAndReturnType(this IMethod method, IMethod overridingMethod)
        {
            var params1 = method.GetParameters().ToArray();
            var params2 = overridingMethod.GetParameters().ToArray();

            if (params1.Length != params2.Length)
            {
                return false;
            }

            var count = params1.Length;
            for (var index = 0; index < count; index++)
            {
                var p1 = params1[index].ParameterType;
                var p2 = params2[index].ParameterType;
                if (!CompareTypeParam(p1, p2))
                {
                    return false;
                }
            }

            return CompareTypeParam(method.ReturnType, overridingMethod.ReturnType);
        }
开发者ID:SperoSophia,项目名称:il2bc,代码行数:31,代码来源:OpCodeExtentions.cs

示例11: GetMulticastDelegateInvoke

        public static void GetMulticastDelegateInvoke(
            IMethod method,
            ITypeResolver typeResolver,
            out byte[] code,
            out IList<object> tokenResolutions,
            out IList<IType> locals,
            out IList<IParameter> parameters)
        {
            parameters = method.GetParameters().ToList();

            var codeList = new IlCodeBuilder();

            codeList.Add(Code.Ldarg_0);
            codeList.Add(Code.Ldfld, 1);

#if MSCORLIB
            // to load value from IntPtr
            codeList.Add(Code.Ldind_I);
#endif

            var jumpForBrtrue_S = codeList.Branch(Code.Brtrue, Code.Brtrue_S);
            codeList.Add(Code.Call, 2);
            codeList.Add(jumpForBrtrue_S);

            codeList.Add(Code.Ldc_I4_0);
            codeList.Add(Code.Stloc_0);

            var labelForFirstJump = codeList.Branch(Code.Br, Code.Br_S);

            // label
            var labelForConditionLoop = codeList.CreateLabel();

            codeList.Add(Code.Ldarg_0);
            codeList.Add(Code.Ldfld, 3);

#if MSCORLIB
            codeList.Add(Code.Castclass, 5);
#endif

            codeList.Add(Code.Ldloc_0);
            codeList.Add(Code.Ldelem_Ref);

            var index = 1;
            foreach (var parameter in parameters)
            {   
                codeList.LoadArgument(index);
                index++;
            }

            codeList.Add(Code.Callvirt, 4);

            if (!method.ReturnType.IsVoid())
            {
                codeList.Add(Code.Stloc_1);
            }

            codeList.LoadLocal(0);
            codeList.LoadConstant(1);
            codeList.Add(Code.Add);
            codeList.SaveLocal(0);

            // label
            codeList.Add(labelForFirstJump);

            // for test
            codeList.LoadLocal(0);
            codeList.LoadArgument(0);
            codeList.Add(Code.Ldfld, 1);

#if MSCORLIB
            // to load value from IntPtr
            codeList.Add(Code.Ldind_I);
#endif

            codeList.Branch(Code.Blt, Code.Blt_S, labelForConditionLoop);

            if (!method.ReturnType.IsVoid())
            {
                codeList.Add(Code.Ldloc_1);
            }

            codeList.Add(Code.Ret);

            code = codeList.GetCode();

            locals = new List<IType>();
            locals.Add(typeResolver.System.System_Int32);
            if (!method.ReturnType.IsVoid())
            {
                locals.Add(method.ReturnType);
            }

            tokenResolutions = new List<object>();

            // 1
            tokenResolutions.Add(method.DeclaringType.BaseType.GetFieldByName("_invocationCount", typeResolver));

            // call Delegate.Invoke
            // 2
            tokenResolutions.Add(
//.........这里部分代码省略.........
开发者ID:afrog33k,项目名称:csnative,代码行数:101,代码来源:DelegateGen.cs

示例12: IsConflictingMember

 private static bool IsConflictingMember(IMethod extension, IMethod method)
 {
     var xp = extension.GetParameters();
     var mp = method.GetParameters();
     if (mp.Length != (xp.Length-1)) return false;
     for (int i = 0; i < mp.Length; ++i)
         if (xp[i + 1].Type != mp[i].Type) return false;
     return true;
 }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:9,代码来源:StricterErrorChecking.cs

示例13: CreateMethodFromPrototype

        public Method CreateMethodFromPrototype(LexicalInfo location, IMethod baseMethod, TypeMemberModifiers newModifiers, string newMethodName)
        {
            var method = new Method(location);
            method.Name = newMethodName;
            method.Modifiers = newModifiers;
            method.IsSynthetic = true;

            if (null != baseMethod.GenericInfo)
                DeclareGenericParameters(method, baseMethod.GenericInfo.GenericParameters);

            DeclareParameters(method, baseMethod.GetParameters(), baseMethod.IsStatic ? 0 : 1);

            method.ReturnType = CreateTypeReference(baseMethod.ReturnType);
            EnsureEntityFor(method);
            return method;
        }
开发者ID:carlosaml,项目名称:boo,代码行数:16,代码来源:BooCodeBuilder.cs

示例14: CheckOverrideSignature

 public static bool CheckOverrideSignature(IMethod impl, IMethod baseMethod)
 {
     return GenericsServices.AreOfSameGenerity(impl, baseMethod)
         && CheckOverrideSignature(impl.GetParameters(), baseMethod.GetParameters());
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:5,代码来源:TypeSystemServices.cs

示例15: IsMatchingParamsAndReturnType

        /// <summary>
        /// </summary>
        /// <param name="method">
        /// </param>
        /// <param name="overridingMethod">
        /// </param>
        /// <returns>
        /// </returns>
        private static bool IsMatchingParamsAndReturnType(this IMethod method, IMethod overridingMethod)
        {
            var params1 = method.GetParameters().ToArray();
            var params2 = overridingMethod.GetParameters().ToArray();

            if (!IsMatchingParams(params1, params2))
            {
                return false;
            }

            return CompareTypeParam(method.ReturnType, overridingMethod.ReturnType);
        }
开发者ID:afrog33k,项目名称:csnative,代码行数:20,代码来源:OpCodeExtentions.cs


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