Advertisement
Guest User

Untitled

a guest
Feb 14th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement