15 questions for “File I/O & Streams”

Found in 1 field. Select a question to see its full answer.

Information Technology

15 questions in 2 technologies

#QuestionTechnologyTopicLevel
1How do you correctly implement async, cancellable file I/O using CancellationToken with FileStream operations? C# › File I/O & StreamsC#File I/O & StreamsAdvanced
2How do you read and write an entire text file's contents using the simplest File class methods? C# › File I/O & StreamsC#File I/O & StreamsBeginner
3What is the difference between File.ReadAllLines() and File.ReadLines() in terms of memory usage? C# › File I/O & StreamsC#File I/O & StreamsBeginner
4How does the 'using' statement (or 'using' declaration) ensure a FileStream is properly closed, even if an exception occurs? C# › File I/O & StreamsC#File I/O & StreamsIntermediate
5How do StreamReader and StreamWriter differ from directly using a FileStream, and when would you choose them? C# › File I/O & StreamsC#File I/O & StreamsIntermediate
6How do you efficiently copy data between two streams using Stream.CopyToAsync(), and why is this preferred over a manual byte-by-byte loop? C# › File I/O & StreamsC#File I/O & StreamsIntermediate
7How do you use FileSystemWatcher to monitor a directory for file changes, and what are its common reliability pitfalls? C# › File I/O & StreamsC#File I/O & StreamsAdvanced
8How would you implement memory-mapped file access using MemoryMappedFile for efficient random access to a very large file? C# › File I/O & StreamsC#File I/O & StreamsAdvanced
9How would you implement a robust, atomic file-write operation that avoids leaving a corrupted or partially-written file if the process crashes mid-write? C# › File I/O & StreamsC#File I/O & StreamsAdvanced
10How would you implement a custom Stream subclass to wrap another stream with additional behavior, like counting bytes read? C# › File I/O & StreamsC#File I/O & StreamsAdvanced