Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

String Reader in C#

String reader is used to read the characters in a string.

  1. using System;
  2. using System.IO;
  3.  
  4. public class ForgetCode
  5. {
  6. public static void Main()
  7. {
  8. string str = "Coming from Forget Code";
  9. char[] b = new char[str.Length];
  10.  
  11. using (StringReader sr = new StringReader(str))
  12. {
  13. // Read 15 characters from the string into the array.
  14. sr.Read(b, 0, 15);
  15. Console.WriteLine(b);
  16. }
  17. }
  18. }


Output:
Coming from For