How to create folder with trailing dot (.) in .NET/C#?
问题 I need to create folders with trailing dots (.) using C#. Here is my code: System.IO.Directory.CreateDirectory("d:\\MyCorp Inc."); But the folder is created without the final dot. Is there a solution? I am using .NET Framework 4.5/C#. My file system is NTFS, on Windows 8. 回答1: Try: using System.Runtime.InteropServices; class Program { [DllImport("kernel32.dll", SetLastError = true)] public static extern bool CreateDirectory(string lpPathName, IntPtr lpSecurityAttributes); private static void