DotNetIO.Path.GetDirectorySeparatorChars C# (CSharp) Method

GetDirectorySeparatorChars() private method

private GetDirectorySeparatorChars ( ) : char[]
return char[]
        public static char[] GetDirectorySeparatorChars()
        {
            return new[] {DirectorySeparatorChar, AltDirectorySeparatorChar};
        }

Usage Example

コード例 #1
0
        /// <summary>
        ///     Removes the path info passes as a parameter from the current root. Only works for two rooted paths with same root.
        ///     Does NOT cover all edge cases, please verify its intended results yourself.
        ///     <example>
        ///     </example>
        /// </summary>
        /// <param name = "other"></param>
        /// <returns></returns>
        public string RemoveParameterFromRoot(PathInfo other)
        {
            Contract.Requires(Root == other.Root, "roots must match to be able to subtract");
            Contract.Requires(FolderAndFiles.Length >= other.FolderAndFiles.Length,
                              "The folders and files part of the parameter must be shorter or equal to in length, than that path you wish to subtract from.");

            if (other.FolderAndFiles == FolderAndFiles)
            {
                return(string.Empty);
            }

            var startIndex = other.FolderAndFiles.Length;

            Contract.Assume(startIndex <= FolderAndFiles.Length);
            var substring = FolderAndFiles.Substring(startIndex);

            return(substring.TrimStart(Path.GetDirectorySeparatorChars()));
        }