本文整理汇总了C#中MemberBinder.GetBaseInstanceMethod方法的典型用法代码示例。如果您正苦于以下问题:C# MemberBinder.GetBaseInstanceMethod方法的具体用法?C# MemberBinder.GetBaseInstanceMethod怎么用?C# MemberBinder.GetBaseInstanceMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemberBinder
的用法示例。
在下文中一共展示了MemberBinder.GetBaseInstanceMethod方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReprResolver
/// <summary>
/// Provides a resolution for __repr__
/// </summary>
private static MemberGroup/*!*/ ReprResolver(MemberBinder/*!*/ binder, Type/*!*/ type) {
// __repr__ for normal .NET types is special, if we're a Python type then
// we'll use one of the built-in reprs (from object or from the type)
if (!PythonBinder.IsPythonType(type) &&
(!type.IsSealed || !type.IsAbstract)) { // static types don't get __repr__
// check and see if __repr__ has been overridden by the base type.
foreach (Type t in binder.GetContributingTypes(type)) {
if (t == typeof(ObjectOps) && type != typeof(object)) {
break;
}
if (t.GetMember("__repr__").Length > 0) {
// type has a specific __repr__ overload, pick it up normally later
return MemberGroup.EmptyGroup;
}
}
// no override, pick up the default fancy .NET __repr__
return binder.GetBaseInstanceMethod(type, "FancyRepr");
}
return MemberGroup.EmptyGroup;
}