![](/img/trans.png)
[英]MS Word Automation in C# - Unable to cast object of type 'System.String[*]' to type 'System.String[]'
[英]Unable to cast object of type 'WhereArrayIterator`1[System.String]' to type 'System.String[]'
我正在嘗試從目錄獲取子目錄路徑,但是忽略了一些文件夾,下面的代碼給了我這個錯誤,
System.InvalidCastException:無法將類型為“ WhereArrayIterator`1 [System.String]”的對象強制轉換為“ System.String []”
有人可以幫忙嗎?
Dim subdirectoryEntries() As String = Directory.GetDirectories(ConfigurationSettings.AppSettings("FsRoot") & Path.DirectorySeparatorChar & readerClientList.GetString(0)).
Where(Function(name) Not name.EndsWith(folder, StringComparison.OrdinalIgnoreCase))
getDirectory的結果where是可查詢的結果,您必須添加。 例如tolist或toarray或類似方法強制轉換為此方法。
希望這個幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.