- Home /
Write and read text files with c#
I searched for some time now, I can't find a solution. How do I write and read text files with c#? (capture ever single line in it's own string)
I was told to use a StreamReader thing, but... how=?
Answer by cowlinator · Nov 20, 2012 at 08:56 PM
Yep, reading and writing text files is part of c# natively, and has nothing to do with Unity.
Read this for examples of how to use StreamReader: http://support.microsoft.com/kb/304430
Here is the documentation for streamreader and streamwriter. This shows you the constructors, properties, and methods as well as what namespace you need to use them.
http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx
http://msdn.microsoft.com/en-us/library/system.io.streamwriter.aspx
Here is a youtube tutorial that demonstrates it's use in visual studio.