Bird
0
0

Which File class static method is used to copy a file from one location to another in C#?

easy🧠 Conceptual Q1 of 15
C Sharp (C#) - File IO
Which File class static method is used to copy a file from one location to another in C#?
AFile.Delete(fileName)
BFile.Move(sourceFileName, destFileName)
CFile.Copy(sourceFileName, destFileName)
DFile.ReadAllText(fileName)
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of each method

    File.Copy copies a file, File.Move moves it, File.Delete deletes, and File.ReadAllText reads content.
  2. Step 2: Match the method to copying files

    Only File.Copy copies a file from one location to another.
  3. Final Answer:

    File.Copy(sourceFileName, destFileName) -> Option C
  4. Quick Check:

    Copy file method = File.Copy [OK]
Quick Trick: Use File.Copy to duplicate files easily [OK]
Common Mistakes:
MISTAKES
  • Confusing File.Move with File.Copy
  • Using File.Delete to copy files
  • Trying to read file content to copy

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes