Пример #1
0
        public bool TryEvaluate(ContentPath path, out IContentNode result)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            result = null;

            if (path == ContentPath.Root)
            {
                result = this;
                return(true);
            }

            var first     = path.First();
            var rawResult = DataSource.Where(pair => pair.Key == first.ToString());

            if (rawResult.Any())
            {
                path = path.Sub(1);

                return(_contentFactory
                       .CreateFrom(rawResult.First().Value)
                       .TryEvaluate(path, out result));
            }

            return(false);
        }
Пример #2
0
        public bool TryEvaluate(ContentPath path, out IContentNode result)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            result = null;
            if (path == ContentPath.Root)
            {
                result = this;
                return(true);
            }

            return(false);
        }
Пример #3
0
 public ContentPathValue(ContentPath path, IContentNode value)
 {
     Path  = path ?? throw new ArgumentNullException(nameof(path));
     Value = value ?? throw new ArgumentNullException(nameof(value));
 }