title: Selecting based on string in a list C# LINQ
body: <p>So I have a class named event which contains a List ListofInvites, It has email addresses of different user(another class which has a emailid property), now I want to select all the  events based on whether the listofinvites string contains that specific email </p>
  
  <p>I have tried this but i'm getting an error </p>
  
  <pre><code>var userEmailID = this.User.Identity.GetUserName();
  
  
  var events = this.dataBase.Events
         .OrderBy(e =&gt; e.DateAndTime)
         .Where(e =&gt; e.listOfInvites.Contains(userEmailID))
         .Select(EventViewModel.ViewModel);
  </code></pre>
  
  <p>Yeah sorry  I was in a hurry last night when i posted this </p>
  
  <p>So I have this event class</p>
  
  <pre><code>public class Event
  {
      public Event()
      {
          this.IsPublic = true;
          this.DateAndTime = DateTime.Now;
      }
      [Key]
      public int EventID { get; set; }
  
      [Required]
      [MaxLength(200)]
      public string Title { get; set; }
  
      [Required]
      public DateTime DateAndTime { get; set; }
  
      public string AuthorId { get; set; }
      public int Duration { get; set; }
      public string Description { get; set; }
      public string OtherDetails { get; set; }
      [MaxLength(200)]
      public string Location { get; set; }
      public bool IsPublic { get; set; }
      public IEnumerable&lt;string&gt; listOfInvites { get; set; }
  
      public string  InviteList { get; set; }
  }
  }
  </code></pre>
  
  <p>the error i'm getting is </p>
  
  <p><code>System.NotSupportedException: 'The specified type member 'listOfInvites' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.'</code></p>