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


C# Path.Skip方法代码示例

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


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

示例1: GetDirectory

        public IDirectory GetDirectory(string directoryPath)
        {
            directoryPath = EnsureTerminatedByDirectorySeparator(directoryPath);

            var resolvedDirectoryPath = System.IO.Path.GetFullPath(System.IO.Path.Combine(CurrentDirectory,directoryPath));

            var path = new Path(resolvedDirectoryPath);

            var pathSegments = new Path(resolvedDirectoryPath).Segments;
            var root = pathSegments.First();
            return pathSegments
                .Skip(1)
                .Aggregate((IDirectory)GetRoot(path.IsUnc ? string.Format("{0}{0}{1}", System.IO.Path.DirectorySeparatorChar, root) : root),
                    (current, segment) => current.GetDirectory(segment));
        }
开发者ID:rvdginste,项目名称:openfilesystem,代码行数:15,代码来源:InMemoryFileSystem.cs

示例2: GetName

        public override string GetName(Path path)
        {
            if (!path.Any()) throw new ArgumentException("Parameter 'path' cannot be empty.");

            return "[" + path.First() + "]" + type.GetName(new Path(path.Skip(1)));
        }
开发者ID:SolomonBier,项目名称:streamvis,代码行数:6,代码来源:RosArray.cs

示例3: GetFile

 public IFile GetFile(string filePath)
 {
     var resolvedFilePath = System.IO.Path.GetFullPath(System.IO.Path.Combine(CurrentDirectory, filePath));
     var pathSegments = new Path(resolvedFilePath).Segments;
     var ownerFolder = pathSegments
         .Skip(1).Take(pathSegments.Count()-2)
         .Aggregate((IDirectory)GetRoot(pathSegments.First()),
             (current, segment) => current.GetDirectory(segment));
     return ownerFolder.GetFile(pathSegments.Last());
 }
开发者ID:rvdginste,项目名称:openfilesystem,代码行数:10,代码来源:InMemoryFileSystem.cs

示例4: GetDirectory

        public IDirectory GetDirectory(string directoryPath)
        {
            directoryPath = EnsureTerminatedByDirectorySeparator(directoryPath);

            var resolvedDirectoryPath = System.IO.Path.GetFullPath(System.IO.Path.Combine(CurrentDirectory,directoryPath));

            var path = new Path(resolvedDirectoryPath);
            var rootPath = System.IO.Path.GetPathRoot(path);
            if (!path.IsUnc &&
                rootPath.Length > 0 &&
                (rootPath[rootPath.Length-1] == System.IO.Path.DirectorySeparatorChar ||
                 rootPath[rootPath.Length-1] == System.IO.Path.AltDirectorySeparatorChar))
                rootPath = rootPath.Substring(0,rootPath.Length - 1);

            var root = GetRoot(rootPath);

            IEnumerable<string> pathSegments = new Path(resolvedDirectoryPath).Segments;

            if (path.IsUnc || rootPath == pathSegments.First())
                pathSegments = pathSegments.Skip(1);
            return pathSegments
                .Aggregate(root,
                    (current, segment) => current.GetDirectory(segment));
        }
开发者ID:openrasta,项目名称:openfilesystem,代码行数:24,代码来源:InMemoryFileSystem.cs


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