--- lang: ja-jp breaks: true --- # C# テンポラリディレクトリを作成する 2023-12-31 ## `net8.0` `<TargetFramework>net8.0</TargetFramework>` ```csharp= string tempFolderPath; // テンポラリフォルダを作成する。 tempFolderPath = Path.Combine( Path.GetTempPath(), Path.GetRandomFileName() ); Console.WriteLine(tempFolderPath); if (Directory.Exists(tempFolderPath) == false) { Directory.CreateDirectory(tempFolderPath); } ``` ###### tags: `C#` `テンポラリディレクトリ` `TEMP`