This would get you a list of new (
!
) "Transmital"-objects, just like you created new objects in your posted code:
private AH_ODS_DB_Entities db = new AH_ODS_DB_Entities();
List<Transmital> rs = db.Transmitals
.Where (sl => sl.Serial == 888)
.Select (sl => new Transmital { Serial = sl.Serial })
.ToList();
Of course you would have to know if that's what you need - to me it looks like it might be by mistake. A query that returns the "original" objects would be this:
private AH_ODS_DB_Entities db = new AH_ODS_DB_Entities();
List<Transmital> rs = db.Transmitals
.Where (sl => sl.Serial == 888)
.ToList();
And then you could use
rs
in some if-statement. If all you would want to check in your if-statement was if there are any matching "Transmitals" then you could use a query that returns a bool instead:
private AH_ODS_DB_Entities db = new AH_ODS_DB_Entities();
bool anyMatchingTransmitals = db.Transmitals
.Where (sl => sl.Serial == 888)
.Any();
Likewise you could use .Count() instead of .Any() if you're interested in the amount of matching "Transmitals" (the return type would be
int instead of
bool then).
Does this help?