Guest User

Untitled

a guest
Jan 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. string[] files = Directory.GetFiles("C:\\");
  2.  
  3. // Array
  4. string[] info = new string[files.Length];
  5. int i = 0;
  6. foreach (string filepath in files)
  7. {
  8. FileInfo inf = new FileInfo(filepath);
  9. info[i] = inf.Name;
  10. i++;
  11. }
  12.  
  13. // List
  14. List<string> info2 = new List<string>();
  15. foreach (string filepath in files)
  16. {
  17. FileInfo inf = new FileInfo(filepath);
  18. info2.Add(inf.Name);
  19. }
Add Comment
Please, Sign In to add comment