public static XPathSequence FnIndexOf(XQueryContext ctx, XPathSequence items, XPathItem item, CultureInfo ci) { ArrayList al = new ArrayList(); IEnumerator e = items.GetEnumerator(); for (int i = 0; e.MoveNext(); i++) { XPathItem iter = e.Current as XPathItem; if (iter.XmlType.TypeCode == XmlTypeCode.String) { if (ci.CompareInfo.Compare(iter.Value, item.Value) == 0) { al.Add(i); } } else { IComparable ic = (IComparable)iter.TypedValue; if (ic.CompareTo((IComparable)item.TypedValue) == 0) { al.Add(i); } } } return(new ListIterator(ctx, al)); }
public static bool FnEmpty(XPathSequence e) { if (e is XPathEmptySequence) { return(true); } return(!e.GetEnumerator().MoveNext()); }