/// <summary> /// Returns all of the extension methods which are applicable for the given type. /// </summary> public IEnumerable <MethodInfo> GetExtensionMethods(PythonType type) { lock (this) { EnsureLoaded(); foreach (var keyValue in _loadedAssemblies) { AssemblyLoadInfo info = keyValue.Value; Debug.Assert(info.Types != null); foreach (var containingType in info.Types) { foreach (var methodList in containingType.ExtensionMethods.Values) { foreach (var method in methodList) { var methodParams = method.GetParameters(); if (methodParams.Length == 0) { continue; } if (PythonExtensionBinder.IsApplicableExtensionMethod(type.UnderlyingSystemType, methodParams[0].ParameterType)) { yield return(method); } } } } } } }
public PythonExtensionBinder GetBinder(PythonContext /*!*/ context) { Debug.Assert(context != null); if (_extBinder == null) { _extBinder = new PythonExtensionBinder(context.Binder, this); } return(_extBinder); }