1

I have a table with various fields and I would like to know how to retrieve only one of those fields using linq and put them to list?

var st = context.myTable.FirstOrDefault.ToList
Spider man
  • 3,118
  • 4
  • 26
  • 41
anchor
  • 1,547
  • 2
  • 10
  • 11

1 Answers1

3

Try this

var st = context.myTable.Select(x => x.SomeProperty).ToList();
Alireza
  • 9,687
  • 4
  • 40
  • 57
Mukesh Kalgude
  • 4,742
  • 2
  • 16
  • 32