title: LINQ To SQL, C#, MVC 4, trouble with a join in model helper
body: <p>I'm pretty new to LINQ to SQL, and until recently have had no problems. Writing in C#.</p>
  
  <p>I've got a model helper .cs file.  I am attempting to create a public list that I can base a view off of.  </p>
  
  <p>Here's the code in the model helper (with extraneous, working, content removed:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  
  namespace sample_runs.Models {
      partial public class SampleRunsDataContext {
          public List&lt;attendee&gt; GetMyRuns(int me) {          
              var mine = (from a in attendees
                         join s in sample_runs 
                              on a.sample_run_id equals s.sample_run_id
                         where a.user_id == me
                         orderby a.sample_run_id descending
                         select new {
                             s.sample_run_id,
                             a.role.role_name,
                             s.sample_run_status.sample_run_status_name,
                             s.project_number,
                             s.run_type.run_type_name,
                             s.description
                         }).ToList();
              return mine;
          }
  
      }
  
  }
  </code></pre>
  
  <p>As for the database, consider the two tables involved like this.  sample_runs is like a list of parties or events.  So, for each line we've got all the information for the party.  Then, we've got a table called attendees, where all the party attendees are listed individually.  Each line has information about attendees, including their 'role' which is where I suppose the metaphor breaks down.  There could be any number of attendees for each party.  The database is pretty with foreign keys and your usual variety of normalization.</p>
  
  <p>All I want is, for a given attendee, a list of all the parties they've been to.  I hope that makes sense.</p>
  
  <p>All my other linq statements and lists in this file are working fine.  This one gives me this brand of grief:</p>
  
  <pre><code>Cannot implicitly convert type 'System.Collections.Generic.List&lt;AnonymousType#1&gt;'
  to 'System.C9ollections.Generic.List&lt;sample_runs.Models.attendee&gt;
  </code></pre>
  
  <p>I'm confused about whether this should be a public list or something else.</p>
  
  <p>I'm unsure whether </p>
  
  <pre><code>List&lt;attendee&gt;
  </code></pre>
  
  <p>should really be </p>
  
  <pre><code>List&lt;attendee&gt;
  </code></pre>
  
  <p>due to the join.</p>
  
  <p>After some research, I've played with what the 'mine' variable gets sent to, and whether this should be a List&lt;> or IENumerable&lt;> etc etc etc.  I am woefully lost.</p>
  
  <p>Just for reference, this is what I want to do with 'GetMyRuns', in the controller:</p>
  
  <pre><code>    public ActionResult myruns() {
          return View(db.GetMyRuns(someintvar));
      }
  </code></pre>
  
  <p>And then I figure I'll build a strongly-typed view and go from there.</p>
  
  <p>I know this may be a softball question, but I'm incredibly grateful for any help you may be able to offer me.</p>
  
  <p>Thank you.</p>