QA


Q&A

Q.

Can I use a text file to save configuration information?

A.

Yes, you could do that. You would need some way to denote the data element. For example, how would you know that the first line was the BackColor setting, as opposed to a default file path, for example? One method would be to append the data element to a caption, as in BackColor=White. You would then have to parse the data as you read it from the text file. The Registry is probably a better solution for something like this, but a text file could be useful if you wanted to transfer settings to a different computer.

Q.

Can I store binary data instead of text to a file?

A.

Visual C# 2005 includes classes designed to work with binary files: BinaryWriter and BinaryReader. You would need to use objects based on these classes, instead of using StreamWriter and StreamReader objects.




Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net