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,224
  • 4
  • 30
  • 42
anchor
  • 1,685
  • 2
  • 11
  • 11

1 Answers1

3

Try this

var st = context.myTable.Select(x => x.SomeProperty).ToList();
Alireza
  • 10,237
  • 6
  • 43
  • 59
Mukesh Kalgude
  • 4,814
  • 2
  • 17
  • 32