Divide text into parts
3 answers
If you are working with files and paths, use FileInfo:
System.IO.FileInfo fi = new System.IO.FileInfo(@"C:\Users\Microsoft\Pictures\2010-04-22\003.jpg
");
string dir = f.DirectoryName;
string file = f.Name;
Or, as Marcelo Cantos says, you can use System.IO.Path. Using Reflector, you can see that the filename FileInfo.Directory calls Path.GetDirectoryName (base.FullPath), so it looks a lot like
+7
a source to share