本文整理汇总了C#中System.Runtime.CompilerServices.CallSite.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# CallSite.GetType方法的具体用法?C# CallSite.GetType怎么用?C# CallSite.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Runtime.CompilerServices.CallSite
的用法示例。
在下文中一共展示了CallSite.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DynamicInstructionN
public DynamicInstructionN(Type delegateType, CallSite site) {
var methodInfo = delegateType.GetMethod("Invoke");
_target = ReflectedCaller.Create(methodInfo);
_targetField = site.GetType().GetField("Target");
_site = site;
_argCount = methodInfo.GetParameters().Length;
}
示例2: DynamicInstructionN
public DynamicInstructionN(Type delegateType, CallSite site)
{
MethodInfo method = delegateType.GetMethod("Invoke");
ParameterInfo[] parameters = method.GetParameters();
this._target = CallInstruction.Create(method, parameters);
this._site = site;
this._argumentCount = parameters.Length - 1;
this._targetDelegate = site.GetType().GetField("Target").GetValue(site);
}
示例3: DynamicInstructionN
public DynamicInstructionN(Type delegateType, CallSite site) {
var methodInfo = delegateType.GetMethod("Invoke");
var parameters = methodInfo.GetParameters();
_target = CallInstruction.Create(methodInfo, parameters);
_targetField = site.GetType().GetField("Target");
_site = site;
_argCount = parameters.Length;
}
示例4: DynamicInstructionN
public DynamicInstructionN(Type delegateType, CallSite site) {
var methodInfo = delegateType.GetMethod("Invoke");
var parameters = methodInfo.GetParameters();
// <Delegate>.Invoke is ok to target by a delegate in partial trust (SecurityException is not thrown):
_targetInvocationInstruction = CallInstruction.Create(methodInfo, parameters);
_site = site;
_argumentCount = parameters.Length - 1;
_targetDelegate = site.GetType().GetInheritedFields("Target").First().GetValue(site);
}
示例5: RewriteCallSite
private Expression RewriteCallSite(CallSite site, TypeGen tg)
{
IExpressionSerializable serializer = site.Binder as IExpressionSerializable;
if (serializer == null)
{
throw new ArgumentException("Generating code from non-serializable CallSiteBinder.");
}
Type siteType = site.GetType();
FieldBuilder fb = tg.AddStaticField(siteType, "sf" + (_id++).ToString());
Expression init = Expression.Call(siteType.GetMethod("Create"), serializer.CreateExpression());
_fieldBuilders.Add(fb);
_fieldInits.Add(init);
Type t = init.Type;
if (t.IsGenericType)
{
Type[] args = t.GetGenericArguments()[0].GetGenericArguments(); ;
// skip the first one, it is the site.
for (int k = 1; k < args.Length; k++)
{
Type p = args[k];
//if (!p.Assembly.GetName().Name.Equals("mscorlib") && !p.Assembly.GetName().Name.Equals("Clojure"))
// Console.WriteLine("Found {0}", p.ToString());
}
}
// rewrite the node...
return Expression.Field(null, fb);
}