本文整理汇总了C#中Mono.CSharp.AParametersCollection.GetEmitTypes方法的典型用法代码示例。如果您正苦于以下问题:C# AParametersCollection.GetEmitTypes方法的具体用法?C# AParametersCollection.GetEmitTypes怎么用?C# AParametersCollection.GetEmitTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.AParametersCollection
的用法示例。
在下文中一共展示了AParametersCollection.GetEmitTypes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefineProxy
/// <summary>
/// C# allows this kind of scenarios:
/// interface I { void M (); }
/// class X { public void M (); }
/// class Y : X, I { }
///
/// For that case, we create an explicit implementation function
/// I.M in Y.
/// </summary>
void DefineProxy (Type iface, MethodInfo base_method, MethodInfo iface_method,
AParametersCollection param)
{
// TODO: Handle nested iface names
string proxy_name = SimpleName.RemoveGenericArity (iface.FullName) + "." + iface_method.Name;
MethodBuilder proxy = container.TypeBuilder.DefineMethod (
proxy_name,
MethodAttributes.HideBySig |
MethodAttributes.NewSlot |
MethodAttributes.CheckAccessOnOverride |
MethodAttributes.Virtual,
CallingConventions.Standard | CallingConventions.HasThis,
base_method.ReturnType, param.GetEmitTypes ());
Type[] gargs = TypeManager.GetGenericArguments (iface_method);
if (gargs.Length > 0) {
string[] gnames = new string[gargs.Length];
for (int i = 0; i < gargs.Length; ++i)
gnames[i] = gargs[i].Name;
#if GMCS_SOURCE
proxy.DefineGenericParameters (gnames);
#else
throw new NotSupportedException ();
#endif
}
for (int i = 0; i < param.Count; i++) {
string name = param.FixedParameters [i].Name;
ParameterAttributes attr = ParametersCompiled.GetParameterAttribute (param.FixedParameters [i].ModFlags);
proxy.DefineParameter (i + 1, attr, name);
}
int top = param.Count;
ILGenerator ig = proxy.GetILGenerator ();
for (int i = 0; i <= top; i++)
ParameterReference.EmitLdArg (ig, i);
ig.Emit (OpCodes.Call, base_method);
ig.Emit (OpCodes.Ret);
container.TypeBuilder.DefineMethodOverride (proxy, iface_method);
}