Exemple #1
0
        public override string ToString()
        {
            switch (this.type)
            {
            case ValueDataType.Boolean:
                return(QueryValueModel.String(this.boolVal));

            case ValueDataType.Double:
                return(QueryValueModel.String(this.dblVal));

            case ValueDataType.Sequence:
                return(QueryValueModel.String(this.sequence));

            case ValueDataType.String:
                return(this.strVal);
            }
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperCritical(new QueryProcessingException(QueryProcessingError.TypeMismatch));
        }
        public string GetResultAsString()
        {
            switch (this.resultType)
            {
            case XPathResultType.Number:
                return(QueryValueModel.String(this.numberResult));

            case XPathResultType.String:
                return(this.stringResult);

            case XPathResultType.Boolean:
                return(QueryValueModel.String(this.boolResult));

            case XPathResultType.NodeSet:
                return(QueryValueModel.String(this.nodeSetResult));
            }
            throw Fx.AssertAndThrow("Unexpected result type.");
        }
Exemple #3
0
        internal static string ToString(object o)
        {
            if (o is bool)
            {
                return(QueryValueModel.String((bool)o));
            }
            if (o is string)
            {
                return((string)o);
            }
            if (o is double)
            {
                return(QueryValueModel.String((double)o));
            }
            if (!(o is XPathNodeIterator))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("QueryFunctionStringArg")));
            }
            XPathNodeIterator iterator = (XPathNodeIterator)o;

            iterator.MoveNext();
            return(iterator.Current.Value);
        }
Exemple #4
0
 internal static double Double(XPathNodeIterator iterator)
 {
     Fx.Assert(null != iterator, "");
     return(QueryValueModel.Double(QueryValueModel.String(iterator)));
 }