public ClrNamespace(string name, ClrNamespace parent = null) { Pointer = Type.Create(); instances.Add(Pointer, this); ObjectManager.Register(this, Pointer); Parent = parent; Name = name; }
private static PythonObject __getattr__(PythonObject self, PythonTuple args) { ClrNamespace me = instances[self]; string name = (args[0] as PythonString).ToString(); string fullName = me.ToIdentifier() + "." + name; Type type = AppDomain.CurrentDomain.GetAssemblies() .Select(a => a.GetType(fullName)) .FirstOrDefault(t => t != null); if (type == null) { return(new ClrNamespace(name, me)); } else { return(TypeManager.ToPython(type)); } }
private static PythonObject __str__(PythonObject self, PythonTuple args) { ClrNamespace me = instances[self]; return(me.ToString()); }