Fan.Sys.FanObj.doTrap C# (CSharp) Méthode

doTrap() private static méthode

private static doTrap ( object self, string name, List args, Type type ) : object
self object
name string
args List
type Type
Résultat object
        private static object doTrap(object self, string name, List args, Type type)
        {
            Slot slot = type.slot(name, true);
              if (slot is Method)
              {
            Method m = (Method)slot;
            return m.m_func.callOn(self, args);
              }
              else
              {
            Field f = (Field)slot;
            int argSize = (args == null) ? 0 : args.sz();
            if (argSize == 0)
            {
              return FanUtil.box(f.get(self));
            }

            if (argSize == 1)
            {
              object val = args.get(0);
              f.set(self, val);
              return FanUtil.box(val);
            }

            throw ArgErr.make("Invalid number of args to get or set field '" + name + "'").val;
              }
        }