本文整理汇总了C#中IronPython.Runtime.Types.PythonType.GetMemberDictionary方法的典型用法代码示例。如果您正苦于以下问题:C# PythonType.GetMemberDictionary方法的具体用法?C# PythonType.GetMemberDictionary怎么用?C# PythonType.GetMemberDictionary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronPython.Runtime.Types.PythonType
的用法示例。
在下文中一共展示了PythonType.GetMemberDictionary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Set__bases__
public static void Set__bases__(CodeContext/*!*/ context, PythonType/*!*/ type, object value) {
// validate we got a tuple...
PythonTuple t = value as PythonTuple;
if (t == null) throw PythonOps.TypeError("expected tuple of types or old-classes, got '{0}'", PythonTypeOps.GetName(value));
List<PythonType> ldt = new List<PythonType>();
foreach (object o in t) {
// gather all the type objects...
PythonType adt = o as PythonType;
if (adt == null) {
OldClass oc = o as OldClass;
if (oc == null) {
throw PythonOps.TypeError("expected tuple of types, got '{0}'", PythonTypeOps.GetName(o));
}
adt = oc.TypeObject;
}
ldt.Add(adt);
}
// Ensure that we are not switching the CLI type
Type newType = NewTypeMaker.GetNewType(type.Name, t, type.GetMemberDictionary(DefaultContext.Default));
if (type.UnderlyingSystemType != newType)
throw PythonOps.TypeErrorForIncompatibleObjectLayout("__bases__ assignment", type, newType);
// set bases & the new resolution order
List<PythonType> mro = CalculateMro(type, ldt);
type.BaseTypes = ldt;
type._resolutionOrder = mro;
}