本文整理汇总了C#中System.Reflection.MethodInfo.GetParametersNoCopy方法的典型用法代码示例。如果您正苦于以下问题:C# MethodInfo.GetParametersNoCopy方法的具体用法?C# MethodInfo.GetParametersNoCopy怎么用?C# MethodInfo.GetParametersNoCopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.MethodInfo
的用法示例。
在下文中一共展示了MethodInfo.GetParametersNoCopy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Emit
[System.Security.SecuritySafeCritical] // auto-generated
public override void Emit(OpCode opcode, MethodInfo meth)
{
if (meth == null)
throw new ArgumentNullException(nameof(meth));
Contract.EndContractBlock();
int stackchange = 0;
int token = 0;
DynamicMethod dynMeth = meth as DynamicMethod;
if (dynMeth == null)
{
RuntimeMethodInfo rtMeth = meth as RuntimeMethodInfo;
if (rtMeth == null)
throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), nameof(meth));
RuntimeType declaringType = rtMeth.GetRuntimeType();
if (declaringType != null && (declaringType.IsGenericType || declaringType.IsArray))
token = GetTokenFor(rtMeth, declaringType);
else
token = GetTokenFor(rtMeth);
}
else
{
// rule out not allowed operations on DynamicMethods
if (opcode.Equals(OpCodes.Ldtoken) || opcode.Equals(OpCodes.Ldftn) || opcode.Equals(OpCodes.Ldvirtftn))
{
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOpCodeOnDynamicMethod"));
}
token = GetTokenFor(dynMeth);
}
EnsureCapacity(7);
InternalEmit(opcode);
if (opcode.StackBehaviourPush == StackBehaviour.Varpush
&& meth.ReturnType != typeof(void))
{
stackchange++;
}
if (opcode.StackBehaviourPop == StackBehaviour.Varpop)
{
stackchange -= meth.GetParametersNoCopy().Length;
}
// Pop the "this" parameter if the method is non-static,
// and the instruction is not newobj/ldtoken/ldftn.
if (!meth.IsStatic &&
!(opcode.Equals(OpCodes.Newobj) || opcode.Equals(OpCodes.Ldtoken) || opcode.Equals(OpCodes.Ldftn)))
{
stackchange--;
}
UpdateStackSize(opcode, stackchange);
PutInteger4(token);
}
示例2: UserConversionMethod
/// <summary>
/// 使用指定的类型转换方法初始化 <see cref="UserConversionMethod"/> 类的新实例。
/// </summary>
/// <param name="method">类型转换方法。</param>
public UserConversionMethod(MethodInfo method)
{
Contract.Requires(method != null && method.GetParametersNoCopy().Length == 1);
this.method = method;
this.inputType = method.GetParametersNoCopy()[0].ParameterType;
}
示例3: Emit
//
//
// Token resolution calls
//
//
public override void Emit(OpCode opcode, MethodInfo meth) {
if (meth == null)
throw new ArgumentNullException("meth");
int stackchange = 0;
int tempVal = 0;
DynamicMethod dynMeth = DynamicMethod.AsDynamicMethod(meth);
if (dynMeth == null) {
if (!(meth is RuntimeMethodInfo))
throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), "meth");
if (meth.DeclaringType != null && (meth.DeclaringType.IsGenericType || meth.DeclaringType.IsArray))
tempVal = m_scope.GetTokenFor(meth.MethodHandle, meth.DeclaringType.TypeHandle);
else
tempVal = m_scope.GetTokenFor(meth.MethodHandle);
}
else {
// rule out not allowed operations on DynamicMethods
if (opcode.Equals(OpCodes.Ldtoken) || opcode.Equals(OpCodes.Ldftn) || opcode.Equals(OpCodes.Ldvirtftn)) {
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOpCodeOnDynamicMethod"));
}
tempVal = m_scope.GetTokenFor(dynMeth);
}
EnsureCapacity(7);
InternalEmit(opcode);
if (opcode.m_push == StackBehaviour.Varpush
&& meth.ReturnType != typeof(void)) {
stackchange++;
}
if (opcode.m_pop == StackBehaviour.Varpop) {
stackchange -= meth.GetParametersNoCopy().Length;
}
// Pop the "this" parameter if the method is non-static,
// and the instruction is not newobj/ldtoken/ldftn.
if (!meth.IsStatic &&
!(opcode.Equals(OpCodes.Newobj) || opcode.Equals(OpCodes.Ldtoken) || opcode.Equals(OpCodes.Ldftn))) {
stackchange--;
}
UpdateStackSize(opcode, stackchange);
m_length=PutInteger4(tempVal, m_length, m_ILStream);
}
示例4: Emit
public override void Emit(OpCode opcode, MethodInfo meth)
{
if (meth == null)
{
throw new ArgumentNullException("meth");
}
int stackchange = 0;
int tokenFor = 0;
DynamicMethod method = meth as DynamicMethod;
if (method == null)
{
if (!(meth is RuntimeMethodInfo))
{
throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), "meth");
}
if ((meth.DeclaringType != null) && (meth.DeclaringType.IsGenericType || meth.DeclaringType.IsArray))
{
tokenFor = this.m_scope.GetTokenFor(meth.MethodHandle, meth.DeclaringType.TypeHandle);
}
else
{
tokenFor = this.m_scope.GetTokenFor(meth.MethodHandle);
}
}
else
{
if ((opcode.Equals(OpCodes.Ldtoken) || opcode.Equals(OpCodes.Ldftn)) || opcode.Equals(OpCodes.Ldvirtftn))
{
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOpCodeOnDynamicMethod"));
}
tokenFor = this.m_scope.GetTokenFor(method);
}
base.EnsureCapacity(7);
base.InternalEmit(opcode);
if ((opcode.m_push == StackBehaviour.Varpush) && (meth.ReturnType != typeof(void)))
{
stackchange++;
}
if (opcode.m_pop == StackBehaviour.Varpop)
{
stackchange -= meth.GetParametersNoCopy().Length;
}
if ((!meth.IsStatic && !opcode.Equals(OpCodes.Newobj)) && (!opcode.Equals(OpCodes.Ldtoken) && !opcode.Equals(OpCodes.Ldftn)))
{
stackchange--;
}
base.UpdateStackSize(opcode, stackchange);
base.PutInteger4(tokenFor);
}