dotnet / dotnet/dotnet-api-docs
Directory.Delete sync or not ?
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
@sybaris commented on [Mon Sep 02 2019](https://github.com/dotnet/dotnet-api-docs.fr-fr/issues/10)
Hi,
The documentation does not specify if this method is synchronous or asynchronous.
When I run the example of this page, the display is "top-level directory exists: FALSE"
I have took the same code, but I create instead 100 files of with 100 000 lines of text (See code below).
And now the display is is "top-level directory exists: TRUE"
Bug or something missing in doc ?
If Directory.Delete must be sync for me it's a bug.
If Directory.Delete is async, this page has to be updated...
Regards,
Sybaris
PS1 : Framework 4.6.1
PS2 : Here the code
static void Main(string[] args)
{
string topPath = @"C:\NewDirectory";
string subPath = @"C:\NewDirectory\NewSubDirectory";
try
{
Directory.CreateDirectory(subPath);
for (int j = 0; j < 100; j++)
using (StreamWriter writer = File.CreateText(subPath + @"\example"+j+".txt"))
{
writer.WriteLine("content added");
for (int i = 0; i < 100000; i++)
{
writer.WriteLine("content added");
}
}
Directory.Delete(topPath, true);
bool directoryExists = Directory.Exists(topPath);
Console.WriteLine("top-level directory exists: " + directoryExists);
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.Message);
}
Console.WriteLine("Press a key to finish");
Console.ReadKey();
}
---
#### Détails du document
⚠ *Ne pas modifier cette section. C’est obligatoire pour docs.microsoft.com ➟ Liaison des problèmes GitHub.*
* ID: fa911a39-d442-3628-1138-98f77525ea6b
* Version Independent ID: 8a3c8131-0199-2d18-e90e-774eaf50a218
* Content: [Directory.Delete Method (System.IO)](https://docs.microsoft.com/fr-fr/dotnet/api/system.io.directory.delete?view=netframework-4.8#feedback)
* Content Source: [xml/System.IO/Directory.xml](https://github.com/dotnet/dotnet-api-docs.fr-fr/blob/live/xml/System.IO/Directory.xml)
* Product: **dotnet-api**
* Technology: **system.io**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**
---
@srvbpigh commented on [Mon Sep 02 2019](https://github.com/dotnet/dotnet-api-docs.fr-fr/issues/10#issuecomment-527144752)
Hello, @sybaris
Thank you for your feedback.
We are actively reviewing your comments and will get back to you soon.
Kind regards,
Microsoft DOCS International Team
Contributor guide
Assessment
This issue has not been assessed yet.