ConvertToInt() public static method

public static ConvertToInt ( object o ) : int
o object
return int
Example #1
0
            protected override object Read(PushbackTextReader r, char pct)
            {
                int ch = r.Read();

                Unread(r, ch);
                //% alone is first arg
                if (ch == -1 || isWhitespace(ch) || isTerminatingMacro(ch))
                {
                    return(registerArg(1));
                }
                //object n = ReadAux(r, true, null, true);
                object n = ReadAux(r);

                if (n.Equals(Compiler._AMP_))
                {
                    return(registerArg(-1));
                }
                if (!Util.IsNumeric(n))
                {
                    throw new ArgumentException("arg literal must be %, %& or %integer");
                }
                return(registerArg(Util.ConvertToInt(n)));
            }
Example #2
0
 public override object invoke(object arg1)
 {
     return(nth(Util.ConvertToInt(arg1)));
 }
Example #3
0
 protected override int Convert(object x)
 {
     return(Util.ConvertToInt(x));
 }