Guest User

Untitled

a guest
Feb 14th, 2020
99
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. string[] lines = System.IO.File.ReadAllLines(@"C:\Users\Public\TestFolder\WriteLines2.txt");
  2.  
  3. string[] lines = System.IO.File.ReadAllLines(@"C:\Users\Public\TestFolder\WriteLines2.txt");
  4.  
  5. // Display the file contents by using a foreach loop.
  6. System.Console.WriteLine("Contents of WriteLines2.txt = ");
  7.  
  8. List<string> res = new List<string>();
  9.  
  10. foreach (string line in lines)
  11. {
  12. if (string.Contains("ObjectList")) {
  13. res.Add(line);
  14. }
  15.  
  16.  
  17. if (string.Contains("[end ObjectList]")) {
  18. res.Add(line);
  19. break;
  20. }
  21. }
RAW Paste Data