Guest User

Untitled

a guest
May 22nd, 2012
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. Getting last field of a Path?
  2. DirectoryInfo di = new DirectoryInfo("Your path");
  3.  
  4. String lastField = di.Name;
  5.  
  6. string folderName = new DirectoryInfo(@ "D:SolutionsTestPluginPluginsDashboardSimu").name;
  7.  
  8. string folderName = Path.GetFileName(@ "D:SolutionsTestPluginPluginsDashboardSimu");
  9.  
  10. using System.IO;
  11.  
  12. string lastComponent
  13. = Path.GetFileName(@"D:SolutionsTestPluginPluginsDashboardSimu");
  14. // Now lastComponent is "DashBoardSimu".
  15.  
  16. string path = @"D:SolutionsTestPluginPluginsDashboardSimu";
  17. string file = Path.GetFileName(path);
  18.  
  19. string dir = @"D:SolutionsTestPluginPlugins", file = "DashboardSimu";
  20. string path = Path.Combine(dir, file);
  21.  
  22. string dd = @"D:SolutionsTestPluginPluginsDashboardSimu";
  23. string[] a = dd.Split('\');
  24. Console.WriteLine(a[a.Length -1]);
Advertisement
Add Comment
Please, Sign In to add comment