98-372 · Question #56
You are creating an application using .NET Framework 4.0. You need to create a text file using the static File.CreateText method. Which of the following values is an acceptable parameter that you can
The correct answer is B. \\server\text.txt C. C:\text.txt E. C:\server\text.txt. The File.CreateText method is used to create or open a file for writing UTF-8 encoded text. The File.CreateText method can accept local file paths or universal naming convention (UNC) paths. The File class is an utility class that is used to provide static methods to create, copy
Question
You are creating an application using .NET Framework 4.0. You need to create a text file using the static File.CreateText method. Which of the following values is an acceptable parameter that you can use? Each correct answer represents a complete solution. Choose all that apply.
Options
- B\server\text.txt
- CC:\text.txt
- Dfile://server/root.txt
- EC:\server\text.txt
How the community answered
(23 responses)- B74% (17)
- D26% (6)
Explanation
The File.CreateText method is used to create or open a file for writing UTF-8 encoded text. The File.CreateText method can accept local file paths or universal naming convention (UNC) paths. The File class is an utility class that is used to provide static methods to create, copy, delete, move, and open files. It is used to provide support in the creation of FileStream objects. It can also be used to get and set file attributes or DateTime information related to the creation, access, and writing of a file. It is more efficient to use the methods of the File class when only one task is to be performed. All methods of the File class require a specified path to the file that is to be Answer: A and D are incorrect. The File.CreateText method cannot accept URLs.
Topics
Community Discussion
No community discussion yet for this question.