ForceDirectoryEnding() public static méthode

Append a Path.DirectorySeparatorChar to the end of the string if one does not already exist.
public static ForceDirectoryEnding ( string str ) : string
str string
Résultat string
        /// <summary>
        /// Find all the <see cref="RuleSetInclude"/>, for a <paramref name="ruleSet"/>,
        /// which are referencing rule sets under <paramref name="rootDirectory"/>
        /// </summary>
        public static IEnumerable <RuleSetInclude> FindAllIncludesUnderRoot(RuleSet ruleSet, string rootDirectory)
        {
            Debug.Assert(ruleSet != null);
            Debug.Assert(!string.IsNullOrWhiteSpace(rootDirectory));


            string ruleSetRoot = PathHelper.ForceDirectoryEnding(Path.GetDirectoryName(ruleSet.FilePath));

            return(ruleSet.RuleSetIncludes.Where(include =>
            {
                string fullIncludePath = PathHelper.ResolveRelativePath(include.FilePath, ruleSetRoot);
                return PathHelper.IsPathRootedUnderRoot(fullIncludePath, rootDirectory);
            }));
        }
        /// <summary>
        /// Updates the <paramref name="ruleSet"/> by deleting all the previously included rule sets
        /// that were in the same folder as <paramref name="solutionRuleSetPath"/> and then includes
        /// the rule set specified by <paramref name="solutionRuleSetPath"/>.
        /// </summary>
        /// <remarks>
        /// The update is in-memory to the <paramref name="ruleSet"/> and we rely on the fact that we
        /// previously generated the 'solutionRuleSet' to the same folder as the updated <paramref name="solutionRuleSetPath"/></remarks>
        /// <param name="ruleSet">Existing project level rule set</param>
        /// <param name="solutionRuleSetPath">Full path of solution level rule set (one that was generated during bind)</param>
        public static void UpdateExistingProjectRuleSet(RuleSet ruleSet, string solutionRuleSetPath)
        {
            Debug.Assert(ruleSet != null);
            Debug.Assert(!string.IsNullOrWhiteSpace(solutionRuleSetPath));

            string projectRuleSetPath = ruleSet.FilePath;

            Debug.Assert(!string.IsNullOrWhiteSpace(projectRuleSetPath));

            // Remove all solution level inclusions
            string solutionRuleSetRoot = PathHelper.ForceDirectoryEnding(Path.GetDirectoryName(solutionRuleSetPath));

            RuleSetHelper.RemoveAllIncludesUnderRoot(ruleSet, solutionRuleSetRoot);

            // Add correct inclusion
            string expectedIncludePath = PathHelper.CalculateRelativePath(projectRuleSetPath, solutionRuleSetPath);

            ruleSet.RuleSetIncludes.Add(new RuleSetInclude(expectedIncludePath, RuleAction.Default));
        }