当前位置: 首页>>代码示例>>C#>>正文


C# Path.ItemAtPath方法代码示例

本文整理汇总了C#中Path.ItemAtPath方法的典型用法代码示例。如果您正苦于以下问题:C# Path.ItemAtPath方法的具体用法?C# Path.ItemAtPath怎么用?C# Path.ItemAtPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path的用法示例。


在下文中一共展示了Path.ItemAtPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Evaluate

        internal override OpenEhr.Paths.AssertionContext Evaluate(OpenEhr.Paths.AssertionContext obj)
        {
            switch (this.ReferenceType.ToLower(System.Globalization.CultureInfo.InvariantCulture))
            {
                case "constraint":
                case "pattern":
                    return new OpenEhr.Paths.AssertionContext(this.Item, obj);
                case "path":
                    string path = this.item.ToString();
                    Path pathProcessor = new Path(path);
                    object objectAtPath = pathProcessor.ItemAtPath(obj.Data);
                    return new OpenEhr.Paths.AssertionContext(objectAtPath, obj);

                default:
                    throw new ApplicationException(string.Format(
                        AmValidationStrings.UnsupportedExprLeafReferenceType, this.ReferenceType));
            }
        }
开发者ID:nickvane,项目名称:OpenEHR,代码行数:18,代码来源:ExprLeaf.cs

示例2: ItemAtPathUtil

        private object ItemAtPathUtil(string path)
        {
            DesignByContract.Check.Require(!string.IsNullOrEmpty(path), "Path must not be null or empty.");

            object itemAtPath;

            if (path == "/")
            {
                Pathable pathableObject = this;

                while (pathableObject.Parent != null)
                    pathableObject = pathableObject.Parent;

                itemAtPath = pathableObject;
            }
            else
            {
                Path pathProcessor = new Path(path);

                //// The itemAtPath can be a single item which is a pathable, a locatable
                //// or a non-pathable item.
                //// The itemAtPath can be an IList instance when the path points to
                //// a locatable collection with multiple items or a single item;
                //// or it can be an IList with one or more
                //// locatables when the path looks like //*[archetype ID] (i.e. the path is not
                //// named and is terminal)
                //// The itemAtPath can be null when the path doesn't exist.
                //object itemAtPath = this.ItemAtPathPathProcessorUtil(pathProcessor);
                itemAtPath = pathProcessor.ItemAtPath(this);

                if (this.itemAtPathDictionary == null)
                    itemAtPathDictionary = new System.Collections.Generic.Dictionary<string, object>();
                // this function is called only when the itemAtPathDictionary doesn't have the key - path,
                // therefore, don't need to check whether the dictionary has the key or not before
                // adding the key-value pair.
                Check.Assert(!this.itemAtPathDictionary.ContainsKey(path), "itemAtPathDiction must not contain path");
                if (itemAtPath != null)
                    this.itemAtPathDictionary.Add(path, itemAtPath);
            }
            return itemAtPath;
        }
开发者ID:nickvane,项目名称:OpenEHR,代码行数:41,代码来源:AttributeDictionaryPathable.cs


注:本文中的Path.ItemAtPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。