Feedback

C# - StringReader and StringWriter

Veröffentlicht von am 9/4/2006
(2 Bewertungen)
Writes a String into the RAM and reades the String from the RAM.
    // Create a StringWriter 
    StringWriter strwtr = new StringWriter(); 
 
    // Write to StringWriter. 
    for(int i=0; i < 10; i++) 
      strwtr.WriteLine("This is i: " + i); 
 
    // Create a StringReader 
 
    StringReader strrdr = new StringReader(strwtr.ToString()); 
 
    // Now, read from StringReader. 
    string str = strrdr.ReadLine(); 
    while(str != null) 
    { 
      str = strrdr.ReadLine(); 
      Console.WriteLine(str); 
    }  
Abgelegt unter StringWriter, StringReader.

Kommentare zum Snippet

 

Logge dich ein, um hier zu kommentieren!