text flies Flashcards
(10 cards)
What is data persistence?
Making data available beyond program execution.
One way to persist data besides text files?
Use a database (e.g., SQL Server, MySQL).
Disadvantage of text files for persistence?
Difficult to identify field boundaries due to variable length.
How to overcome variable length field issue?
Use delimiters like , or |.
What does CSV stand for?
Comma Separated Values.
How do you read a file in C#?
File.ReadAllText(“filename.txt”);
How do you write to a file in C#?
File.WriteAllText(“filename.txt”, data);
How do you append to a text file?
File.AppendAllText(“filename.txt”, data);
What is a stream?
A flow of data used to read/write files.
Why use using for file I/O?
Ensures automatic disposal of resources.