Skip to content

Instantly share code, notes, and snippets.

@changhuixu
Created August 29, 2019 18:47
Show Gist options
  • Save changhuixu/819f67d707eaec571822adb07bc2cb79 to your computer and use it in GitHub Desktop.
Save changhuixu/819f67d707eaec571822adb07bc2cb79 to your computer and use it in GitHub Desktop.
A model class with a LINQ Expression
public class Author
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public Membership Membership { get; set; }
public static Expression<Func<Author, bool>> GoldAndUp = x =>
x.Membership == Membership.Gold || x.Membership == Membership.Platinum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment