Given a file and we have to copy its content to another file using C# program.
File.Copy()
This is a method of "File class, which is used to copy all data of source file to the destination file.
Syntax:
File.Copy(source_file,dest_file);
Parameter(s):
- source_file - From which we are copying data content.
- dest_file - In which data is being copied.
-
Program
Output
Note: In above program, we need to remember, when we use "File" class, System.IO namespace must be included in the program.
In above function, overwriting a file with the same name is not allowed.
need an explanation for this answer? contact us directly to get an explanation for this answer