StringWriter . .
StringWriter()
, . ToString().
, StringReader StringWriter.
// // StringReader StringWriter.
Using System; using System.10;
class StrRdrWtrDemo { static void Main() {
StringWriter strwtr = null;
StringReader strrdr = null;
try {
// StringWriter. strwtr = new StringWriter();
// StringWriter. for (int i=0; i < 10; i++)
strwtr.WriteLine(" i : " + i);
// StringReader. strrdr = new StringReader(strwtr.ToString());
// StringReader. string str = strrdr.ReadLine(); while(str!= null) {
str = strrdr.ReadLine();
Console.WriteLine(str);
}
} catch(IOException exc) {
Console.WriteLine(" -\" + exc.Message);
} finally {
// , if(strrdr!= null) strrdr.Close(); if(strwtr!= null) strwtr.Close ();
}
}
}
.
i : 1 i : 2 i : 3 i : 4 i : 5 i : 6 i : 7 i : 8 i : 9
strwtr StringWriter,B WriteLine(). StringReader , strwtr. ToString () strwtr. , ReadLine ().
File
.NET Framework File, , , . , File , , , , , , ( , .). , File , FileStream . File , . (), Exists () GetLastAccessTime (). , , File. , File .
|
|
Filelnfo. File , : , . Filelnfo.
()
, . , (), File. .
static void Copy (string __, string __) static void Copy (string __, string __, boolean overwrite)
Copy () , __, , __. , , _-_, . , overwri te true. , IOException FileNotFoundException.
() . . , . , .
/* , File.CopyO.
, . , FIRST.DAT SECOND.DAT, :