[英]How to fix this event related error in VB.net (windows phone 7)
[英]How to fix this foor loop error in vb.net (windows phone)
我對此有一個錯誤循環。 沒有聲明Var,因此會產生錯誤,但是Var不是聲明。
For Each file As var In files
Debug.WriteLine("Deleting... " & Convert.ToString(file))
isf.DeleteFile(file)
Next
簡單,Var不是類型。 刪除as var
,這是沒有用的。
讓編譯器使用推斷,或指定正確的類型(我想象的文件)
For Each file In files
Debug.WriteLine("Deleting... " & Convert.ToString(file))
isf.DeleteFile(file)
Next
要么
For Each file as File In files
Debug.WriteLine("Deleting... " & Convert.ToString(file))
isf.DeleteFile(file)
Next
編輯:關於解釋for each
:如果你不指定你的迭代器(a型file
在你的情況下),編譯器將試圖確定它的類型適合你。
在某些毛茸茸的情況下,它無法確定正確的類型,因此您必須使用as
為他指定它。 但是對於您而言,我相信無需指定類型即可使用for。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.