AccessProviderSample.AccessDBProvider.GetParentPath C# (CSharp) Méthode

GetParentPath() protected méthode

Removes the child segment of the path and returns the remaining parent portion
protected GetParentPath ( string path, string root ) : string
path string /// A full or partial provider specific path. The path may be to an /// item that may or may not exist. ///
root string /// The fully qualified path to the root of a drive. This parameter /// may be null or empty if a mounted drive is not in use for this /// operation. If this parameter is not null or empty the result /// of the method should not be a path to a container that is a /// parent or in a different tree than the root. ///
Résultat string
        protected override string GetParentPath(string path, string root)
        {
            // If root is specified then the path has to contain
            // the root. If not nothing should be returned
            if (!String.IsNullOrEmpty(root))
            {
                if (!path.Contains(root))
                {
                    return null;
                }
            }

            return path.Substring(0, path.LastIndexOf(pathSeparator, StringComparison.OrdinalIgnoreCase));
        }