2012-11-02 145 views

回答

0

使用DirectoryInfo和Parent,例如,

var directoryInfo = new DirectoryInfo(abovePath); 
var parentDirectoryName = directoryInfo.Parent.Name; 
var grandParentDirectoryName = directoryInfo.Parent.Parent.Name; 

注意你想對這些但這null檢查的總體思路