1. 程式人生 > >asp.net mvcview介面does not contain a definition

asp.net mvcview介面does not contain a definition

  在cshtml使用linq操作資料集,自動補全是可以使用Select,但是一直提示System.Collection.GenericList' does not contain a definition for 'Select' ccepting a first argument of type 'System.Collections.GenericList' could be found (are you missing a using directive or an assembly reference?)。

  一段沒有特殊寫法的程式碼,一直覺得肯定是一個很傻的操作引起的,但是引用System.Linq,仍然報錯,就開始懷疑是不是整個專案引用有問題。後來把dll全部重新引用一遍,折騰了很久,但是結果還是沒有解決。不經意間發現頭部的@使用上,少了一個},補全後就恢復正常了。

  開發過程時常遇到莫名其妙的問題,大部分是不小心造成的,仔細檢查程式碼就可以了