Edit

Share via


FileSystemAclExtensions.CreateDirectory(DirectorySecurity, String) Method

Definition

Creates a directory and returns it, ensuring it is created with the specified directory security. If the directory already exists, the existing directory is returned.

public:
[System::Runtime::CompilerServices::Extension]
 static System::IO::DirectoryInfo ^ CreateDirectory(System::Security::AccessControl::DirectorySecurity ^ directorySecurity, System::String ^ path);
public static System.IO.DirectoryInfo CreateDirectory (this System.Security.AccessControl.DirectorySecurity directorySecurity, string path);
static member CreateDirectory : System.Security.AccessControl.DirectorySecurity * string -> System.IO.DirectoryInfo
<Extension()>
Public Function CreateDirectory (directorySecurity As DirectorySecurity, path As String) As DirectoryInfo

Parameters

directorySecurity
DirectorySecurity

An object that determines the access control and audit security for the directory.

path
String

The path of the directory to create.

Returns

A directory information object representing either a created directory with the provided security properties, or the existing directory.

Exceptions

directorySecurity or path is null.

path is empty.

Could not find a part of the path.

Access to the path is denied.

Remarks

This extension method was added to .NET Core to bring the functionality that was provided by the System.IO.Directory.CreateDirectory(System.String,System.Security.AccessControl.DirectorySecurity) .NET Framework method.

Applies to