Copy the entire contents of a directory in C#

前端 未结 22 1102
日久生厌
日久生厌 2020-11-22 07:13

I want to copy the entire contents of a directory from one location to another in C#.

There doesn\'t appear to be a way to do this using System.IO class

22条回答
  •  日久生厌
    2020-11-22 07:42

    Here's a utility class I've used for IO tasks like this.

    using System;
    using System.Runtime.InteropServices;
    
    namespace MyNameSpace
    {
        public class ShellFileOperation
        {
            private static String StringArrayToMultiString(String[] stringArray)
            {
                String multiString = "";
    
                if (stringArray == null)
                    return "";
    
                for (int i=0 ; i

提交回复
热议问题