本文整理汇总了C#中IMethodInfo.GetGenericArgsMapping方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodInfo.GetGenericArgsMapping方法的具体用法?C# IMethodInfo.GetGenericArgsMapping怎么用?C# IMethodInfo.GetGenericArgsMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethodInfo
的用法示例。
在下文中一共展示了IMethodInfo.GetGenericArgsMapping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FuzzyMethod
private FuzzyMethod(FuzzyType target, IMethodInfo runtimeMethod)
{
_method = runtimeMethod;
var genericArgs = new List<FuzzyType>();
foreach (var genericArg in _method.GetMethodGenericArguments())
genericArgs.Add(FuzzyType.FromRuntimeType(genericArg));
GenericArguments = genericArgs.AsReadOnly();
Target = target;
ReturnValue = FuzzyType.FromRuntimeType(_method.ReturnType);
Args = _method.GetParameters()
.Select(param => FuzzyType.FromRuntimeType(param.ParameterType))
.ToArray();
// establishing links between typedef generic args and method's generic args
// read more comments at FuzzyType.GetFieldOrProperty
// see also comments to ReflectionHelper.GetGenericArgsMapping
foreach (var pair in _method.GetGenericArgsMapping())
{
var typeDefArg = SelectGenericArg(pair.Value);
var publicTypePointArgs = SelectGenericArg(pair.Key);
publicTypePointArgs.IsIdenticalTo(typeDefArg);
}
// SomeMoreStuffInferred handlers for children just escalate the event
// no need to process it since everything necessary is already done by links
//
// upd. currently noone cares about this event from this very class,
// but imo it's still important to comply to FuzzyMetadata contract
Target.SomeMoreStuffInferred += (o, e) => FireSomeMoreStuffInferred();
ReturnValue.SomeMoreStuffInferred += (o, e) => FireSomeMoreStuffInferred();
Args.ForEach(arg => arg.SomeMoreStuffInferred += (o, e) => FireSomeMoreStuffInferred());
// Register typepoints for debug -> 0 downtime in release, but immensely useful in debug mode
var methodBinding = target.DebuggableParents.OfType<FuzzyMethodBinding>().SingleOrDefault();
if (methodBinding != null)
{
this.RegDebuggableParent(methodBinding).SetDesc("alt");
ReturnValue.RegDebuggableParent(this).SetDesc("ret");
Args.ForEach((arg, i) => arg.RegDebuggableParent(this).SetDesc("arg" + i));
}
}