0

Hi I have a ICollection:

using System.Linq;
...
public virtual ICollection<MyObject> MyList { get; set; }

And want to get the first result or use a Where clause for find a result in the implemented property, for example:

var x = test.MyList.Where(c => c.MyId == 1);

But my object do not list the methods like Where or FirstOrDefault

1 Answers1

1

This should do it:

var x = test.MyList.Where(c => c.MyId == 1).FirstOrDefault();
Damjan Tomic
  • 390
  • 2
  • 11