Пример #1
0
    //
    // Summary:
    //     Creates a subdirectory or subdirectories on the specified path with the specified
    //     security. The specified path can be relative to this instance of the System.IO.DirectoryInfo
    //     class.
    //
    // Parameters:
    //   path:
    //     The specified path. This cannot be a different disk volume or Universal Naming
    //     Convention (UNC) name.
    //
    //   directorySecurity:
    //     The security to apply.
    //
    // Returns:
    //     The last directory specified in path.
    //
    // Exceptions:
    //   T:System.ArgumentException:
    //     path does not specify a valid file path or contains invalid DirectoryInfo characters.
    //
    //   T:System.ArgumentNullException:
    //     path is null.
    //
    //   T:System.IO.DirectoryNotFoundException:
    //     The specified path is invalid, such as being on an unmapped drive.
    //
    //   T:System.IO.IOException:
    //     The subdirectory cannot be created.-or- A file or directory already has the name
    //     specified by path.
    //
    //   T:System.IO.PathTooLongException:
    //     The specified path, file name, or both exceed the system-defined maximum length.
    //     For example, on Windows-based platforms, paths must be less than 248 characters,
    //     and file names must be less than 260 characters. The specified path, file name,
    //     or both are too long.
    //
    //   T:System.Security.SecurityException:
    //     The caller does not have code access permission to create the directory.-or-The
    //     caller does not have code access permission to read the directory described by
    //     the returned System.IO.DirectoryInfo object. This can occur when the path parameter
    //     describes an existing directory.
    //
    //   T:System.NotSupportedException:
    //     path contains a colon character (:) that is not part of a drive label ("C:\").
    public DirEntry CreateSubdirectory(string path, DirectorySecurity directorySecurity)
    {
        var d = new DirEntry(path, this);

        d.Create(directorySecurity);
        return(d);
    }