test/Shared/FunctionalTests.Transitional/TestHelpers/IOHelpers.cs
/// <summary>
/// Copies the specified source files to a given directory.
/// </summary>
/// <param name="destinationDirectory"> The destination directory. </param>
/// <param name="sourceFiles"> The source files. </param>
Copies the specified source files to a given directory.
Copies the specified source files to a given directory .
[SecuritySafeCritical]
        [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
        public static void CopyToDirectory(string destinationDirectory, params string[] sourceFiles)
        {
            foreach (var sourceFile in sourceFiles)
            {
                var baseName = Path.GetFileName(sourceFile);
                var destinationFile = Path.Combine(destinationDirectory, baseName);
                if (new FileInfo(sourceFile).FullName
                    != new FileInfo(destinationFile).FullName)
                {
                    File.Copy(sourceFile, destinationFile, true);
                }
            }
        }
[ SecuritySafeCritical ] [ PermissionSet ( SecurityAction . Assert , Unrestricted = true ) ] public static void CopyToDirectory ( string destinationDirectory , params string [ ] sourceFiles ) { foreach ( var sourceFile in sourceFiles ) { var baseName = Path . GetFileName ( sourceFile ) ; var destinationFile = Path . Combine ( destinationDirectory , baseName ) ; if ( new FileInfo ( sourceFile ) . FullName != new FileInfo ( destinationFile ) . FullName ) { File . Copy ( sourceFile , destinationFile , true ) ; } } }
Copies the specified source files to a given directory.
Copies the specified source files to a given directory .
// Calling File.Copy demands FileIOPermission (Write flag) for the destination file path.
destinationDirectory
string
The destination directory.
The destination directory .
sourceFiles
The source files.
The source files .