def fn(): a = ArrayList() b = ArrayList() a.Add(b) c = a.get_Item(0) # type of c is Object c = clidowncast(c, ARRAY_LIST) c.Add(None) return c.get_Item(0)
def finish_code(self): delegatetype = dotnet.typeof(LoopDelegate) # initialize the array of genconsts consts = dotnet.new_array(System.Object, len(self.consts)) for av_const, i in self.consts.iteritems(): consts[i] = av_const.get_cliobj() # build the delegate func = self.meth_wrapper.create_delegate(delegatetype, consts) return dotnet.clidowncast(func, LoopDelegate)
def fn(flag): a = ArrayList() a.Add(None) if flag: obj = cliupcast(a, System.Object) else: obj = box(42) b = clidowncast(obj, ArrayList) return b.get_Item(0)
def fn(): obj = box(c) t = clidowncast(obj, System.Type) return t.get_Name()
def fn(flag): if flag: x = a else: x = b return clidowncast(box(x), System.Type).get_Name()
def fn(): int32_obj = box(int32_class) int32_type = clidowncast(int32_obj, System.Type) return int32_type.get_Name()
def class2type(cls): 'Cast a PBC of type ootype.Class into a System.Type instance' return clidowncast(box(cls), System.Type)
def fn(): utils_obj = box(utils_class) utils_type = clidowncast(utils_obj, System.Type) return utils_type.get_Name()