How do I get fullname of parent Directory in ASP.NET 2.0 / C#?

I'm trying to get the full path of the parent directory using Sytem.IO's built in .Parent function, but they only return the name of the parent directory, not the full name. So I get this:

FullName                   Name            Parent
----------------------------------------------------
C:\Temp\First             First             Temp
C:\Temp\Second       Second        Temp
C:\Temp\Third            Third            Temp

I really want to make the parent field C:\Temp. So I was thinking to remove the name from the fullname, then prefix to the parent name. What's the best way to do this?
bemara57Asked:
Who is Participating?
 
drichardsCommented:
Which Parent are you referring to?

On DirectoryInfo, you can do .Parent.FullName to get the complete path.  .Parent.Name just gives you the folder name.
0
 
bemara57Author Commented:
I didn't know Parent.FullName existed.. that's exactly what I needed. Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.