prepRet() приватный Метод

private prepRet ( Type t, Object x ) : Object
t System.Type
x Object
Результат Object
Пример #1
0
        // used in generated code
        public static object GetInstanceFieldOrProperty(object target, string fieldName)
        {
            Type t = target.GetType();

            FieldInfo field = GetField(t, fieldName, false);

            if (field != null)
            {
                return(Reflector.prepRet(field.FieldType, field.GetValue(target)));
            }

            PropertyInfo prop = GetProperty(t, fieldName, false);

            if (prop != null)
            {
                return(Reflector.prepRet(prop.PropertyType, prop.GetValue(target, new object[0])));
            }

            MethodInfo method = GetArityZeroMethod(t, fieldName, false);

            if (method != null)
            {
                return(Reflector.prepRet(method.ReturnType, method.Invoke(target, new object[0])));
            }

            throw new ArgumentException(String.Format("No matching instance field/property found: {0} for {1}", fieldName, t));
        }
Пример #2
0
        public object reduce(IFn f, object start)
        {
            object ret = f.invoke(start, Reflector.prepRet(_ct, _array[_i]));

            for (int x = _i + 1; x < _array.Length; x++)
            {
                ret = f.invoke(ret, Reflector.prepRet(_ct, _array[x]));
            }
            return(ret);
        }
Пример #3
0
        public object reduce(IFn f, object start)
        {
            object ret = f.invoke(start, Reflector.prepRet(_ct, _a.GetValue(_i)));

            for (int x = _i + 1; x < _a.Length; x++)
            {
                ret = f.invoke(ret, Reflector.prepRet(_ct, _a.GetValue(x)));
            }
            return(ret);
        }
Пример #4
0
        public override int IndexOf(object value)
        {
            int n = _a.Length;

            for (int j = _i; j < n; j++)
            {
                if (Util.equals(value, Reflector.prepRet(_ct, _a.GetValue(j))))
                {
                    return(j - _i);
                }
            }
            return(-1);
        }
Пример #5
0
 public override object first()
 {
     return(Reflector.prepRet(_ct, _array[_i]));
 }
Пример #6
0
 public override object first()
 {
     return(Reflector.prepRet(_ct, _a.GetValue(_i)));
 }