Example #1
0
        public static bool Exists <TDocument, TContent>(this ILookupInResult <TDocument> result, Expression <Func <TDocument, TContent> > path)
        {
            // ReSharper disable ConditionIsAlwaysTrueOrFalse
            if (result == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(result));
            }
            if (path == null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(path));
            }
            // ReSharper restore ConditionIsAlwaysTrueOrFalse

            var pathString = SubDocumentPathExpressionVisitor.GetPath(result, path);
            var index      = result.IndexOf(pathString);

            if (index < 0)
            {
                ThrowHelper.ThrowArgumentException(nameof(path), $"Path '{pathString}' is not found.");
            }

            return(result.Exists(index));
        }
 public bool Exists(int index) => _inner.Exists(index);