0
我試圖檢索我傳入的路徑的子目錄。它處理它,並給我一半的子目錄,但另一半,它會返回一個「?」調試時。我不知道是什麼原因造成這種 這裏是我有:C#,.getDirectories(字符串文件)問題檢索目錄
string root = @"C:\Users\Documents\Meta Consumer";
string[] subDir = Directory.GetDirectories(root);
當調試:
1:(好)
2:(好)
3:(好)
..
:?(這是14)
:(15是這裏)
..
?:?
看起來像http://stackoverflow.com/questions/10918981/get-question-mark-instead-property-name-and-value-in-debug-mode-in-visual-studio –
的實例你可以添加一個搜索參數並指定'AllDirectories'或'TopLevelDirectory'如下:'string [] subDir = Directory.GetDirectories(root,「*。*」,SearchOption.AllDirectories);'然後實際編寫一個'foreach循環'返回那些價值。 – Greg
我運行你的確切代碼,並從我的'用戶\ Documents \ somepathwithsubfolders'拉,它工作正常..也許你需要在管理模式下運行Visual Studio – MethodMan