System.Collections.Generic.List不包含“选择”的定义 [英] System.Collections.Generic.List does not contain a definition for 'Select'

查看:1783
本文介绍了System.Collections.Generic.List不包含“选择”的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此错误是在许多文件发生在我的视图文件夹:

System.Collection.GenericList不包含选择接受型System.Collections.GenericList'的第一个参数的定义可以找到(是否缺少using指令或程序集引用?)

我已经尝试加入一些使用系统......等基本库靠近文件顶部,但添加这些似乎并没有任何帮助的。

这是对我来说发生的错误是在开头的行
 .BindTo(Model.Users.Select(O => o.UserName)):

任何帮助将大大AP preciated。谢谢!

 < D​​IV ID =editRolesContainer级=detailContainer detailContainer4>
    <头类=sectionheader>添加角色< /头>
    &所述;微升的id =AdminSelectUserContainer>
       <立GT;
          < UL风格=填充:0 0 0 5像素>
             <立GT;选择用户:LT; /李>
             <立GT;
                @using(Html.BeginForm(srch_GetUserRoles,管理,
                   新{视图=Users_Roles},FormMethod.Post,
                   新{NAME =srch_GetUserRoles}))
                {
                   @(Html.Telerik()。自动完成()
                          。名称(acx_SelectUser)
                          .BindTo(Model.Users.Select(O => o.UserName))
                              .HtmlAttributes(新{型提交})
                          .HtmlAttributes(新{@class =搜索盒})
                          .AutoFill(真)
                          .Filterable((过滤=>
                              {
                                 filtering.FilterMode(AutoCompleteFilterMode.Contains);
                              }))
                  )
                }
             < /李>
            < / UL>
           ...
           ...
           < / DIV>


解决方案

只需添加这个命名空间,

 使用System.Linq的;

This error is happening in many of the files in my "Views" folder:

'System.Collection.GenericList' does not contain a definition for 'Select' accepting a first argument of type 'System.Collections.GenericList' could be found (are you missing a using directive or an assembly reference?)

I've tried adding a bunch of "using System..." and other basic libraries near the top of the file but adding those do not seem to help any.

This is where the error occurs for me is in the line that starts with .BindTo(Model.Users.Select(o => o.UserName)):

Any help would be greatly appreciated. Thanks!

 <div id="editRolesContainer" class="detailContainer detailContainer4">
    <header class="sectionheader"> Add Roles </header>
    <ul id = "AdminSelectUserContainer" >
       <li>
          <ul style="padding: 0 0 0 5px">
             <li>Select User : </li>
             <li>
                @using (Html.BeginForm("srch_GetUserRoles", "Admin",
                   new { view = "Users_Roles" }, FormMethod.Post,
                   new { name = "srch_GetUserRoles" }))
                {
                   @(Html.Telerik().AutoComplete()
                          .Name("acx_SelectUser")
                          .BindTo(Model.Users.Select(o => o.UserName))
                              .HtmlAttributes(new { type "submit"   })
                          .HtmlAttributes(new { @class = "SearchBox"})
                          .AutoFill(true)
                          .Filterable((filtering =>
                              {
                                 filtering.FilterMode(AutoCompleteFilterMode.Contains);
                              }))
                  )
                }
             </li>
            </ul>
           ...
           ...
           </div>

解决方案

Just add this namespace,

using System.Linq;

这篇关于System.Collections.Generic.List不包含“选择”的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆