title: Simple question regarding LINQ
body: <p>I have this problem in a LINQ implementation. The errors I get are inclined within the code as comments</p>
  
  <pre><code>public partial class _Default : Page 
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          if (!this.IsPostBack)
          {
              GridViewBind(string.Empty);
          }
      }
  
      private void GridViewBind(string criteria)
      {
          string strConn = ConfigurationManager.ConnectionStrings["linqconnstr"].ConnectionString;
  
          MyDB _db = new MyDB(strConn);
  
          IEnumerable&lt;UserRecord&gt; results;
  
          if(criteria == string.Empty)
          {
              // 'System.Data.Linq.Table&lt;UserRecord&gt;' does not contain a definition      
              // for 'ToArray' and no extension method 'ToArray' accepting a first
              // argument of type 'System.Data.Linq.Table&lt;UserRecord&gt;' could be found
              // (are you missing a using directive or an assembly reference?)
              results = _db.user.ToArray(); // error line under .ToArray();
          }
          else
          {
              // Could not find an implementation of the query pattern for source
              // type 'System.Data.Linq.Table&lt;UserRecord&gt;'.  'Where' not found.
              // are you missing a reference to 'System.Core.dll' or a using
              // directive for 'System.Linq'? // error line under _db
              results = (from c in _db.user
                         where c.Username.Contains(criteria)
                         select c).ToArray();
          }
          gvwUsers.DataSource = results;
          gvwUsers.DataBind();
      }
  }
  </code></pre>
  
  <p>Here is the other classes:</p>
  
  <pre><code>public class MyDB : DataContext
  {
      public MyDB(string connStr) : base(connStr)
      {
      }
  
      public Table&lt;UserRecord&gt; user;
  }
  
  [Table(Name = "tblUsers")]
  public class UserRecord
  {
      [Column(IsDbGenerated = true, IsPrimaryKey = true)]
      public int UserID { get; set; }
  
      [Column(DbType = "nvarchar(30)")]
      public string Username { get; set; }
  
      [Column(DbType = "nvarchar(30)")]
      public string Password { get; set; }
  }
  </code></pre>